部署gitlab的時候,一啓動,發現80和8080端口已經被佔用,無奈,只得先將監聽80端口的nginx和監聽8080端口的jenkins中止。這會兒有空,琢磨一下如何修改gitlab的默認端口。nginx
修改主要分爲兩部分,一部分是gitlab總的控制文件,一部分是子模塊真實監聽端口的修改。git
當前我使用的是官方rpm 813版本。sql
## Advanced settings
unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 8082
nginx['listen_addresses'] = ['*']
nginx['listen_port'] = 82 # override only if you use a reverse proxy: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#setting-the-nginx-listen-port
# What ports/sockets to listen on, and what options for them. #listen "127.0.0.1:8080", :tcp_nopush => true listen "127.0.0.1:8082", :tcp_nopush => true listen "/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket", :backlog => 1024
server {
listen *:82;
server_name gitlab.123.123.cn;
server_tokens off; ## Don't show the nginx version number, a security best practice
gitlab-ctl restart
server {
listen 80; server_name gitlab.123.123.cn; location / { #rewrite ^(.*) http://127.0.0.1:8082; proxy_pass http://127.0.0.1:8082; } }
後來在提交的時候,出現了錯誤:shell
找了關於8080端口的相關信息,最後發現api
配置文件:/var/opt/gitlab/gitlab-shellsocket
修改爲tcp
# GitLab user. git by default user: git # Url to gitlab instance. Used for api calls. Should end with a slash. #gitlab_url: "http://127.0.0.1:8080" gitlab_url: "http://127.0.0.1:82" ## 關鍵是這個地方,由於82是gitlab nginx端口,不過上面的端口乾嗎是8080來,8080應該是unicorn的監聽端口。 http_settings: