在服务器/云开发方面,我是一个新手。 所以我租了一个vServer并开始玩耍。首先使用nginx。我做了自己的配置,一切顺利,在正确的子/域上获得了正确的html文件:
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 repo,并按本教程所示安装了它: https://www.howtoforge.com/tutorial/how-to-install-gitlab-on-debian-8/#install-the-prerequisites
Gitlab运行顺利。但是现在我的问题是,它覆盖了所有子域以及域本身。我之前写的配置似乎被某种与gitlab一起安装的第二个Nginx跳过了。
我尝试通过service nginx stop
阻止它,但是当我再次尝试service nginx start
时,这是响应:
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
因此,我停顿了下来,看到了仍在运行的Nginx进程。我杀死了它们,但它们总是再次自动启动。
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.
我不知道该怎么办。 有人可以帮忙吗?
请, 一个菜鸟:)
答案 0 :(得分:0)
从错误日志中,可以看到Old Nginx进程已经在使用80端口。
尝试使用/etc/init.d/nginx stop
或systemctl stop nginx
或/usr/sbin/nginx -s stop
停止旧进程。
答案 1 :(得分:0)
经过数小时的搜索和尝试后,我偶然发现了gitlab.rb文件中的此链接: https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server
它说明了如何通过自己安装的Nginx Web服务器使用。 这解决了我的问题。