2017-07-03 75 views
0

我不知道我是否需要转储以查找或搜索解决方案,或者根本不可能。前一段时间,我做了标准的Gitlab安装(https://about.gitlab.com/installation/#ubuntu)。到目前为止,Gitlab运行良好。在标准的gitlab安装上运行另一个网站

现在,我想运行Gitlab安装旁边的其他网站。这怎么可能?我无法找到gitlab正在使用的服务器以及如何配置其他网站。 操作系统是Ubuntu 17.04。

编辑:我想运行一个php项目。通常我使用的是Apache,我有足够的知识。

+0

GItLab配备了一个自己的nginx的。你可以简单地安装另一个nginx或apache并运行你的网站。但是你必须指定端口和代理。 – talaub

+0

为什么不设置另一个虚拟机?就性能或配置管理而言,这确实不是一个好主意。如果你真的想,你需要看看自定义NGINX配置添加不同的路由/虚拟主机。 –

+0

这就是我的问题。我没有找到任何nginx配置。我也尝试安装Apache,但我无法运行该服务。 – DS87

回答

0

推荐的方法是禁用内部Web服务器并使用Ubuntu提供的Apache。有这个

基本上你有一些文件,以更改以下:

1)/etc/gitlab/gitlab.rb:

nginx['enable'] = false 

2)添加WWW的数据到组gitlab www的

3)创建一个虚拟主机看起来有点像这样:

DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public 

<Location /> 
    Require all granted 
    #Allow forwarding to gitlab-workhorse 
    ProxyPassReverse http://127.0.0.1:8181 
    ProxyPassReverse http://gitlab.thoughtgang.de/ 
</Location> 

您可以在Gitlab文档中找到详细指南:https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server

我一直在使用Gitlab进行测试,并且运行时没有任何问题。

0

Gitlab:Ningx =>Inserting custom settings into the NGINX config

编辑您的gitlab的/etc/gitlab/gitlab.rb:

nano /etc/gitlab/gitlab.rb 

和sroll nginx的[ 'custom_nginx_config']和如下修改使确定取消注释

# Example: include a directory to scan for additional config files 
nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/*.conf;" 

创建新配置目录:

mkdir -p /etc/nginx/conf.d/ 
nano /etc/nginx/conf.d/new_app.conf 

和内容添加到您的新的配置

# my new app config : /etc/nginx/conf.d/new_app.conf 
# set location of new app 
upstream new_app { 
    server localhost:1234; # wherever it might be 
} 
# set the new app server 
server { 
    listen *:80; 
    server_name new_app.mycompany.com; 
    server_tokens off; 
    access_log /var/log/new_app_access.log; 
    error_log /var/log/new_app_error.log; 
    proxy_set_header Host  $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    location/{ proxy_pass http://new_app; } 
} 

,并重新配置gitlab获得新设置插入

gitlab-ctl reconfigure 

,并重新启动nginx

gitlab-ctl restart nginx 

您的新应用程序应该可以访问。

PS:检查nginx错误日志:

tail -f /var/log/gitlab/nginx/error.log