nginx:nginx:[emerg]bind()到0.0.0.0:80失败(98:地址已在使用)
我不能启动nginx。每次在命令行中键入“nginx”,我都会看到:nginx:nginx:[emerg]bind()到0.0.0.0:80失败(98:地址已在使用),nginx,Nginx,我不能启动nginx。每次在命令行中键入“nginx”,我都会看到: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 印刷几次 我使用ubuntu 14.04 我已经累了: 将本地地址更改为80以外的其他地址(如70),但错误是 nginx:[emerg]bin
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
印刷几次
我使用ubuntu 14.04
我已经累了:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18170/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3156/sshd
tcp6 0 0 :::80 :::* LISTEN 18170/nginx
tcp6 0 0 :::22 :::* LISTEN 3156/sshd
之后
热熔器-k80/tcp
我得到:
80/tcp:18170 18171
netstat显示:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3156/sshd
tcp6 0 0 :::22 :::* LISTEN 3156/sshd
我尝试重新启动nginx
service nginx stop
service nginx start
但当我再次键入nginx时,我看到
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
再次,几次
nginx -t
显示:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
此外,我没有安装apache
My/etc/nginx/conf.d/[sitename]conf:
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name [sitename] www.[sitename];
root /var/www/[sitename];
index index.html;
gzip on;
gzip_comp_level 3;
gzip_types text/plain text/css application/javascript image/*;
}
我试着跑:
grep -r listen /etc/nginx/*
检查listen是否未设置两次,但仅显示:
/etc/nginx/conf.d/[sitename].conf: listen 80;
/etc/nginx/conf.d/[sitename].conf: listen [::]:80 ipv6only=on;
/etc/nginx/nginx.conf:# listen localhost:110;
/etc/nginx/nginx.conf:# listen localhost:143;
我很困惑,因为netstat显示nginx实际上在那个端口上,但我仍然得到一个错误并且我的网页不可访问(404未找到,nginx)
我还可以尝试什么?我认为现在发生的是,您已经运行了nginx,并且正在尝试再次运行它。你有两种方法开始 1-手动使用sudo nginx 2-或使用Systemctl(在重新启动或失败时自动启动nginx) 因此,如果您已经使用了“1”,那么运行“2”会告诉您地址已被占用是正常的。反之亦然
我建议您重新启动,然后使用systemctl
sudo systemctl restart nginx重新启动nginx
,然后检查其运行状态nginxsudo systemctl
。如果其处于活动状态,则不要再次尝试运行sudo nginx
。为什么要尝试手动运行nginx?它是作为一个服务运行的,我通过linode ssh来完成它,我已经按照他们的指示完成了所有的事情——我不知道如何以任何其他方式来完成它;尤其是我的网站没有运行。