ChatGPT解决这个技术问题 Extra ChatGPT

nginx - nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

突然间我收到以下 nginx 错误

 * Restarting nginx
 * Stopping nginx nginx
   ...done.
 * Starting nginx nginx
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
   ...done.
   ...done.

如果我跑

lsof -i :80 or sudo fuser -k 80/tcp 

我什么都得不到。 80端口什么都没有

然后我运行以下命令:

sudo netstat -pan | grep ":80"
tcp        0      0 127.0.0.1:8070          0.0.0.0:*               LISTEN      15056/uwsgi     
tcp        0      0 10.170.35.97:39567      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39564      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39584      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39566      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39571      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39580      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39562      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39582      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39586      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39575      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39579      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39560      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39587      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39591      10.158.58.13:8080       TIME_WAIT   -               
tcp        0      0 10.170.35.97:39589      10.158.58.13:8080       TIME_WAIT   - 

我难住了。我该如何调试?

我在端口 8070 上使用带有代理传递的 uwsgi。uwsgi 正在运行。 Nginx 不是。我正在使用 ubuntu 12.4

以下是我的 nginx 配置文件的相关部分

upstream uwsgi_frontend {
          server 127.0.0.1:8070;
        }
server {
listen 80;
        server_name 127.0.0.1;
        location = /favicon.ico {
                  log_not_found off;
                }



                location / {
                       include uwsgi_params;
                       uwsgi_buffering off;

                       uwsgi_pass 127.0.0.1:8070;
                 }
        }

这是我在 ubuntu 12.04 上安装 nginx 的方法

nginx=stable;add-apt-repository ppa:nginx/$nginx;
apt-get update
apt get install nginx-full
我发现了我以前从未遇到过的问题。我不得不删除 /etc/nginx/sites-available/default。然后它起作用了。我的 conf 在 /etc/nginx/default
我正在运行 Nginx+Varnish 并出现此错误。解决方案是先停止两者,然后先启动 nginx,然后再启动清漆。
您可以尝试停止命名服务。
您是否已从启用站点中删除了默认设置?
我在这里尝试了所有解决方案。检查所有正在使用的端口(NGINX 本身正在使用它)所以我关闭了端口并重新启动它。像魅力一样工作。

v
vinzee

我通过运行解决了这个问题:

sudo apachectl stop

事实证明 apache 在后台运行并阻止 nginx 在所需的端口上启动。

在 Ubuntu 上,运行:

sudo /etc/init.d/apache2 stop

在 Ubuntu 14.04 上使用 sudo /etc/init.d/apache2 stop 停止 apache
原因是您不能让两个 Web 服务器监听同一个端口。选择一个,如果需要,代理。例如,使用 nginx,但对于某些请求(例如 php 文件),代理到 Apache 端口。
谢谢。但是知道为什么它突然开始了吗?我有一个星期没有碰服务器,但它是昨晚开始的。
也许您的服务器重新启动并且您已将 apache 配置为在启动时启动?和/或其他服务需要 apache 作为依赖项。它也可能有助于了解有关您的操作系统设置的更多信息
感谢您的解决方案。它对我有用,我使用谷歌云平台
D
Dee

我的情况不同,我必须杀死正在运行的 Nginx 进程才能重新启动它。

代替

sudo systemctl restart nginx

我不得不使用:

sudo pkill -f nginx & wait $!
sudo systemctl start nginx

我正在接受 404 Not Found,我使用了你的建议,现在我确实解决了我的问题。谢谢。
这对我有用。其他什么都没做。不确定系统重新启动时会启动什么进程,但我将在我的重新启动 nginx 例程中添加它。谢谢!
这个解决方案解决了我的问题👍
最好坚持以一种方式在您的 nginx 服务上运行。我通过使用 nginx -s reload 而不是使用 systemctl 让它进入了一个糟糕的状态
我爱你;谢谢你。 sudo pkill -f nginx & wait $! 拯救了这一天。
i
iSkore

[::]:80 是一个 ipv6 地址。

如果您的 nginx 配置正在侦听端口 80 和端口 [::]:80,则可能会导致此错误。

我的默认站点可用文件中有以下内容:

listen 80;
listen [::]:80 default_server;

您可以通过将 ipv6only=on 添加到 [::]:80 来解决此问题,如下所示:

listen 80;
listen [::]:80 ipv6only=on default_server;

有关更多信息,请参阅:

http://forum.linode.com/viewtopic.php?t=8580

http://wiki.nginx.org/HttpCoreModule#listen


您也可以通过删除listen 80来修复它;因为 listen [::]:80 同时监听 IPv4 和 IPv6。不过要小心,因为某些系统(如 FreeBSD)将 IPv4 和 IPv6 套接字分开,然后它就不起作用了,但对于 Linux,它应该没问题。 wiki.nginx.org/HttpCoreModule#listen
感谢您对此进行深入研究并解释为什么删除 /etc/nginx/sites-available/default 有助于解决上述错误。
即使我注释掉 ipv6 行,当我尝试 sudo service nginx restart 时仍然会收到相同的错误。当我执行 netstat -tulpn |grep 80 时,我只获得一次 nginx 进程 (0.0.0.0:80)。任何想法为什么它不会重新启动?
我赞同@rednaw 所说的,但您可以简单地将其注释掉,而不是删除监听
设置 ipv6only=on 解决了这个问题,但 nginx 应该真正检测到它正在尝试绑定到同一个 interface:port 两次。
s
shareef

我发现了我以前从未遇到过的问题。

我只需要删除 /etc/nginx/sites-available/default。然后它起作用了。

此删除将仅删除符号链接,作为备份,您可以在 /etc/nginx/sites-enabled/default 中找到默认文件

我的 conf 在 /etc/nginx/default 中。


+1这个解决方案对我有用,但后来我认为默认情况下一定有一些东西实际上是导致问题的原因,所以我挖得更深一些,并提供了一个包含更多信息的答案。
我认为删除默认站点配置模板不是最好的解决方案 - 在同一模板中注释包含 listen 80; 的行已经解决了问题并且正确地解决了问题。你的把戏很有效,但这不是我未来的读者会做的事情。这就是为什么我建议您选择@Nathan 的答案作为正确答案。
运行 apt-get dist-upgrade 后我遇到了同样的问题,它升级了 nginx 包,它在 /etc/nginx/sites-enabled 中创建了到 /etc/nginx/sites-available/default 的链接。 nginx 试图加载这个默认配置,它通过 IPv6 侦听端口 80,然后它还加载了我读取的真实配置。删除该符号链接解决了问题。
您不需要删除 /etc/nginx/sites-available/default,只需删除指向它的符号链接 - sudo rm /etc/nginx/sites-enabled/default
我在尝试在端口 8080 上运行 nginx 并在端口 80 上运行 varnish 时遇到了这个问题,与此答案类似,我发现问题是 nginx 默认配置仍在侦听端口 80,即使我的 sites-available 配置都在端口 8080 上侦听。它位于 /etc/nginx/conf.d/default
E
Eje

我也遇到了同样的错误。

nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

当我在浏览器中输入 localhost 时,我得到了

有用!

这是此服务器的默认网页。

Web 服务器软件正在运行,但尚未添加任何内容。而不是 nginx 欢迎页面,apache2 在同一个端口上运行,

找到 apache2 ports.conf 文件 sudo /etc/apache2/ports.conf 更改除 80 以外的端口,我将其设为 70 保存文件 重新启动系统

它也适用于您,如果您在浏览器中键入 localhost,您将获得 nginx 欢迎页面


您可能根本不想同时运行 Apache2 和 nginx。我发现 Apache 安装启动了服务。于是,我发出“sudo /etc/init.d/apache2 stop”,然后就可以正常启动nginx了。这也使您免于重新启动系统。
你是对的,删除 /etc/nginx/sites-enabled/default 符号链接确实会阻止它监听两个端口。我发现每个关于 nginx 的教程都从建议每个人删除“默认”链接开始,但我认为这是一个不同的主题,这实际上有点烦人。
@IgorGanapolsky 将 Apache 切换到不同的端口?
g
greybeard

尝试执行此命令

sudo fuser -k 443/tcp
service nginx restart

fuser 命令将找到进程 id(PID) 并且 -k 标志将终止启用 nginx 重新启动的进程。


这工作得很好:)
B
Black

我的问题是我有重叠的监听指令。我设法通过运行找出重叠的指令

grep -r listen /etc/nginx/*

两个文件在同一个端口监听:

/etc/nginx/conf.d/default.conf:           listen 80;  
/etc/nginx/sites-enabled/default.conf:    listen 80;

这是一种非常简洁的检查方式:grep -r listen /etc/nginx/* 感谢分享!
谢谢你,先生!但是,一个问题是,不会修改另一个侦听端口 80 让我们说 70 导致任何错误吗?
T
Trần Tuấn Anh

我通过运行解决了

sudo killall apache2

sudo fuser -k 443/tcp

最后

sudo service nginx start

W
Wagner Pereira

我在letsencrypt(certbot)和nginx中遇到了同样的问题,

参考:https://github.com/certbot/certbot/issues/5486

这个错误还没有解决办法

因此,更改了 cron 以进行更新(在更新后重新加载)(使用来自 certbot 的建议)

-- in /etc/cron.d/certbot
from
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew 
to
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew --pre-hook "service nginx stop" --post-hook "service nginx start"

日志(短):

-- in /var/log/syslog
Jun 10 00:14:25 localhost systemd[1]: Starting Certbot...
Jun 10 00:14:38 localhost certbot[22222]: nginx: [error] open() "/run/nginx.pid$
Jun 10 00:14:41 localhost certbot[22222]: Hook command "nginx" returned error c$
Jun 10 00:14:41 localhost certbot[22222]: Error output from nginx:
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:443 $
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:80 f$
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:443 $
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:80 f$
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:443 $
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:80 f$
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:443 $
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:80 f$
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:443 $
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] bind() to 0.0.0.0:80 f$
Jun 10 00:14:41 localhost certbot[22222]: nginx: [emerg] still could not bind()
Jun 10 00:14:41 localhost systemd[1]: Started Certbot.


-- in /var/log/nginx/error.log
2018/06/10 00:14:27 [notice] 22233#22233: signal process started
2018/06/10 00:14:31 [notice] 22237#22237: signal process started
2018/06/10 00:14:33 [notice] 22240#22240: signal process started
2018/06/10 00:14:34 [notice] 22245#22245: signal process started
2018/06/10 00:14:38 [notice] 22255#22255: signal process started
2018/06/10 00:14:38 [error] 22255#22255: open() "/run/nginx.pid" failed (2: No $
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:443 failed (98: Addr$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:80 failed (98: Addre$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:443 failed (98: Addr$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:80 failed (98: Addre$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:443 failed (98: Addr$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:80 failed (98: Addre$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:443 failed (98: Addr$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:80 failed (98: Addre$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:443 failed (98: Addr$
2018/06/10 00:14:39 [emerg] 22261#22261: bind() to 0.0.0.0:80 failed (98: Addre$
2018/06/10 00:14:39 [emerg] 22261#22261: still could not bind()

超级随机,但我相信这是我的问题。感谢您发布此内容。我的错误似乎是因为它试图更新一个过时的域条目,但因为我不再控制域而不能。
我想这可能也是我的问题。但我需要等待看看
Z
Zbigniew Malcherczyk

我使用 supervisor 在 Docker 容器上并排运行 Nginx 和 Gunicorn。

这是用于 supervisor 的配置:

[supervisord]
nodaemon=true

[program:gunicorn]
command = /project/start.sh
user = www-data

[program:nginx]
command=/usr/sbin/nginx

问题是我如何默认启动 Ngnix,它在前台运行。这使得主管重试运行另一个 Nginx 实例。

您可以通过在命令行中添加 -g 'daemon off;' 或在配置文件顶部添加 daemon off; 来解决问题,Nginx 停留在前台,主管停止尝试运行另一个实例。


K
Kamal Kumar

首先在 /etc/apache2/ports.conf 中将 apache 监听端口 80 更改为 8080 apache 包括

Listen 1.2.3.4:80 to 1.2.3.4:8080
sudo service apache2 restart 

或者

sudo service httpd restart    // in case of centos

然后将 nginx 添加为将监听 apache 端口的反向代理服务器

server {
 listen   1.2.3.4:80;
 server_name  some.com;

 access_log  /var/log/nginx/something-access.log;

 location / {
  proxy_pass http://localhost:8080;
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }


location ~* ^.+\.(jpg|js|jpeg|png)$ {
   root /usr/share/nginx/html/;
}

location /404.html {
  root /usr/share/nginx/html/40x.html;
}

error_page 404 /404.html;
    location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
    location = /50x.html {
}

# put code for static content like js/css/images/fonts
}

修改后重启 nginx 服务器

sudo service nginx restart

现在所有流量都将由 nginx 服务器处理,并将所有动态请求发送到 apache,静态内容由 nginx 服务器提供服务。

对于像缓存这样的高级配置:

https://www.linode.com/docs/web-servers/nginx/slightly-more-advanced-configurations-for-nginx/#basic-nginx-caching


p
possum jones

我知道这是旧的,但还要确保你的 docker 容器都没有在端口 80 上。这是我的问题。


与此类似,就我而言,我有 haproxy 正在运行
B
Big Dumb

多个服务可以在同一个端口上侦听。这个问题通常来自于在同一台机器上混合 Apache 和 NGINX。

去检查:

sudo netstat -plant | grep 80

停止 Apache 并重启 NGINX:

sudo systemctl stop apache2 && sudo systemctl restart nginx && sudo systemctl status nginx


o
oscarz

我遇到了类似的问题。日志如下

2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: still could not bind()
2018/10/31 12:54:23 [alert] 127997#127997: unlink() "/run/nginx.pid" failed (2: No such file or directory)
2018/10/31 22:40:48 [info] 36948#36948: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:68
2018/10/31 22:50:40 [emerg] 37638#37638: duplicate listen options for [::]:80 in /etc/nginx/sites-enabled/default:18
2018/10/31 22:51:33 [info] 37787#37787: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:68

最后一个 [emerg] 显示 duplicate listen options for [::]:80 这意味着有多个包含 [::]:80 的 nginx 块文件。

我的解决方案是删除 [::]:80 设置之一

PS你可能有默认的块文件。我的建议是将此文件保留为端口 80 的默认服务器。并从其他块文件中删除 [::]:80


我这样做了,我从其他配置文件 [::]:80 及其工作中删除了!但它安全吗?什么时候没有默认监听器?
M
Matthijs

就我而言,罪魁祸首原来是一个服务器块,其中包含:

        listen  127.0.0.1:80;
        listen  [::1]:80 ipv6only=on;
        server_name  localhost;

在 Linux 上,侦听特定 IP(例如 [::1]:80)的套接字与侦听同一端口但任何 IP(例如 [::]:80)的套接字冲突。通常情况下,nginx 会在后台使用单个套接字透明地处理这个问题。但是,在 listen 指令上显式指定 ipv6only(或某些其他选项)会强制 nginx(尝试)为其创建单独的套接字,从而导致 Address already in use 错误。

由于 ipv6only=on 无论如何都是默认值(从 1.3.4 开始),因此修复只是从该指令中删除该选项,并确保在我的配置中的其他任何地方都没有使用 ipv6only


R
Rishikesh Chandra

就我而言,Apache、Apache2 或 Nginx 中的一项服务已经在运行,因此我无法启动另一项服务。


a
atazmin

我在 AWS Lightsail 上遇到了这个错误,使用了上面的最佳答案

listen [::]:80;

listen [::]:80 ipv6only=on default_server;

然后单击我的 AWS 帐户中的“重启”按钮,我有主服务器 Apache 和 Nginx 作为代理。


A
Allen

我的站点可用目录中有几个来自不同 NGINX 配置文件的 *.save 文件(来自 nano 的紧急转储)。删除这些 .save 文件后,NGINX 重新启动正常。我认为这些是无害的,因为没有相应的符号链接,但我想我错了。


L
Lance Cleveland

继续@lfender6445 和@SAURABH 的回答——

我的问题还在于,在升级到 Vagrant 2.2.2 之后,来宾启动时 Apache2 作为 Web 服务器运行。过去我只有 nginx 作为 Web 服务器。

vagrant ssh 进入盒子并运行以下命令以禁用 Apache2 在访客盒子启动时启动:

sudo update-rc.d -f apache2 remove

退出 ssh,vagrant 停止,vagrant up。问题解决了。


D
Deejay

如果尝试上述任何解决方案后问题仍然存在,请重新启动服务器一次。它对我有用:)


是的,它会的。但是杀死 nginx 进程然后重新启动 nginx 也可以。这就是@datdinhquoc 的答案。
z
zombi_man

我有同样的问题,但我看到 Nginx 监听了端口 80:

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      9730/nginx 

但是当我尝试重新启动它时,我遇到了错误:

    service nginx restart
Stopping nginx:                                            [FAILED]
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()

我的问题在配置文件中,我设置了 PID 文件,并且似乎系统无法正确捕获它:

user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

当我删除它时,它起作用了。


B
Brian Nicholls

在 Ubuntu 上为我工作的快速解决方案。首先找到当前运行的nginx实例:

ps aux | grep nginx

复制 pid(例如 123456)并运行

kill -9 123456


R
Redjam

对我来说,问题是我正在用 Supervisor 运行一个应用程序,而另一个用 Systemd 运行。在使用 Supervisor 运行的应用程序中,我有一个配置文件来处理 Nginx。我停止了这个过程并在没有它的情况下重新启动了 Supervisor。

现在 Nginx 是由 Systemd 启动的,我不再有这个问题了。


D
Delowar Hossain

我正在使用 nginx 运行 Varnish 服务器。我的清漆服务器在端口 80 上运行,因此,我的 nginx 服务器没有启动。我在所有 nginx 配置文件中将端口更改为 8088,但我的 default.conf 文件位于 Ubuntu 服务器的 /etc/nginx/conf.d 目录中。

由于我的 conf.d 目录包含在主 /etc/nginx.conf 文件中,nginx 没有启动。

将 /etc/nginx/conf.d/default.conf 重命名为 /etc/nginx/conf.d/default.conf.backup 后,nginx 成功启动,或者我可以注释掉或从我的 nginx.conf 中删除 include /etc/nginx/conf.d/*.conf;文件。


关注公众号,不定期副业成功案例分享
关注公众号

不定期副业成功案例分享

领先一步获取最新的外包任务吗?

立即订阅