2017-07-03 77 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