Gitlab ist 覆盖了所有子域,甚至覆盖了我的整个 nginx.config

Gitlab ist overlaying all subdomains and even my entire nginx.config

我在那些服务器/云开发方面还很陌生。 所以我租了一个 vServer 开始玩。首先用nginx。我做了自己的配置,一切顺利,在右边得到了正确的 html 文件 sub-/domains:

    server {
            listen 80;
            server_name beispiel.de;

            location / {
                    root /var/www/beispiel;
                    index index.html;
            }
    }
    server{
            listen 80;
            server_name gitlab.beispiel.de;

            location / {
                    root /var/www/beispiel/gitlab;
                    index index.html;
            }
    }

然后我想通过 gitlab 运行 我自己的 git 回购,我按照本教程所示安装了它: https://www.howtoforge.com/tutorial/how-to-install-gitlab-on-debian-8/#install-the-prerequisites

Gitlab 运行非常流畅。但我现在的问题是,它覆盖了所有子域以及域本身。我之前写的配置似乎被某种第二个 nginx 跳过了,安装了 gitlab.

我试图通过 service nginx stop 阻止它,但当我再次尝试 service nginx start 时,这是回应:

Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.

所以我 htop-ed 并看到 nginx 进程仍然 运行nung。我杀了他们,但他们总是再次自动启动。

systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Tue 2019-12-17 14:58:43 CET; 3min 48s ago
Process: 13257 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile 
/run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 1539 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, 
status=1/FAILURE)
Process: 1537 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, 
status=0/SUCCESS)
Main PID: 13321 (code=exited, status=0/SUCCESS)

Dec 17 14:58:40 v2201912109976104637.goodsrv.de nginx[1539]: nginx: [emerg] bind() to 0.0.0.0:80 
failed (98: Address already...use)
Dec 17 14:58:41 v2201912109976104637.goodsrv.de nginx[1539]: nginx: [emerg] bind() to 0.0.0.0:80 
failed (98: Address already...use)
Dec 17 14:58:41 v2201912109976104637.goodsrv.de nginx[1539]: nginx: [emerg] bind() to 0.0.0.0:80 
failed (98: Address already...use)
Dec 17 14:58:42 v2201912109976104637.goodsrv.de nginx[1539]: nginx: [emerg] bind() to 0.0.0.0:80 
failed (98: Address already...use)
Dec 17 14:58:42 v2201912109976104637.goodsrv.de nginx[1539]: nginx: [emerg] bind() to 0.0.0.0:80 
failed (98: Address already...use)
Dec 17 14:58:43 v2201912109976104637.goodsrv.de nginx[1539]: nginx: [emerg] still could not bind()
Dec 17 14:58:43 v2201912109976104637.goodsrv.de systemd[1]: nginx.service: control process exited, 
code=exited status=1
Dec 17 14:58:43 v2201912109976104637.goodsrv.de systemd[1]: Failed to start A high performance web 
server and a reverse pro...rver.
Dec 17 14:58:43 v2201912109976104637.goodsrv.de systemd[1]: Unit nginx.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

我不知道该怎么办。 有人可以帮忙吗?

此致, 菜鸟:)

从错误日志来看,老的Nginx进程已经在使用80端口了。

尝试/etc/init.d/nginx stopsystemctl stop nginx/usr/sbin/nginx -s stop停止旧进程。

经过几个小时的谷歌搜索和尝试,我在 gitlab.rb 文件中偶然发现了这个 link: https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server

它解释了如何使用您自己安装的 nginx 网络服务器。 这解决了我的问题。