浏览 3.5k
在 linode centos7 上安装gitlab-ce,安装之后默认的nginx被停止。
现在无法关闭gitlab自带的nginx,使用kill进程也是一样。
[root@linode nginx]# ps aux | grep nginx
root 4223 0.0 0.0 4188 792 ? Ss 21:53 0:00 runsv nginx
root 4224 0.0 0.0 4332 644 ? S 21:53 0:00 svlogd -tt /var/log/gitlab/nginx
root 4527 0.0 0.2 26888 4352 ? Ss 21:57 0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+ 4528 0.0 0.3 31140 7612 ? S 21:57 0:00 nginx: worker process
root 4918 0.0 0.1 112668 2272 pts/1 S+ 22:02 0:00 grep --color=auto nginx
[root@linode nginx]# [root@linode nginx]# systemctl status nginx
nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since 二 2015-11-10 21:53:18 CST; 11min ago
Docs: http://nginx.org/en/docs/
Process: 4246 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Process: 4243 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
11月 10 21:53:15 linode nginx[4243]: nginx: configuration file /etc/nginx/nginx.conf test is successful
11月 10 21:53:15 linode nginx[4246]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 10 21:53:16 linode nginx[4246]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 10 21:53:16 linode nginx[4246]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 10 21:53:17 linode nginx[4246]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 10 21:53:17 linode nginx[4246]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
11月 10 21:53:18 linode nginx[4246]: nginx: [emerg] still could not bind()
11月 10 21:53:18 linode systemd[1]: nginx.service: control process exited, code=exited status=1
11月 10 21:53:18 linode systemd[1]: Failed to start nginx - high performance web server.
11月 10 21:53:18 linode systemd[1]: Unit nginx.service entered failed state.
[root@linode nginx]# 
按点赞数排序
按时间排序
我重新安装了1.4.7版本,试了下,还是没有你说的现象。建议你重新试下,或者贴出你完整的配置文件,以及测试方法,咱们一次性彻底搞明白。
就我的经验来说,只有连续的if会出错,你上面列出的仅有1个if,通常不应该有问题,我也很好奇。
给你看下我的配置和运行结果:


配置依赖server_name指令,比如:
http {
server {
listen 80;
server_name www.a.com;
}
server {
listen 80;
server_name www.b.com;
}
}实现原理也很简单,基于HTTP协议格式前提:域名www.a.com是放在HTTP请求的Host头部中,比如Host: www.b.com。
而Nginx处理与请求时,会首先接收到完整的HTTP头部,再开始根据nginx.conf中的server{ }配置中的server_name域名做匹配,最后决定如何处理(严格来说,是在URL或者Host头部解析到域名后,就会立刻通过哈希表找到对应的server块).
location / {
proxy_pass http://inter-router;
proxy_set_header Host ***;
proxy_http_version 1.1;
}
location ^~ /websocket/ {
proxy_pass http://inter-router/websocket/;
proxy_set_header Host ***;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;
}
不要把websocket 配置放到通配符里面,那样就全部都是了,只对websocket部分,这样用,示例如上
微信公众号
加入微信群