大网数据广告活动
服务器运维问答

Nginx Port 443 already in use by it self?

· 52CE 我爱测

I am totally new to Nginx and just playing around with my domain, that I had laying around and not used. Thought I might aswell put it to good use and host API on it. But wanted to learn some Nginx first. When I check the error l…

问题原文

原帖链接 · Kiksen · CC BY-SA 4.0

I am totally new to Nginx and just playing around with my domain, that I had laying around and not used. Thought I might aswell put it to good use and host API on it. But wanted to learn some Nginx first.

When I check the error log I get the following error:

2020/09/07 10:49:54 [emerg] 32432#32432: bind() to 0.0.0.0:443 failed (98: Address already in use)

When I check "sudo netstat -tulpn":

tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      32455/nginx: master
tcp6       0      0 :::443                  :::*                    LISTEN      32455/nginx: master

It is nginx it self that is using the port 443?

My config is just overwriting the default nginx conf named "default" in sites-availble and looks like this:

server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;

ssl on;
ssl_certificate /home/ubuntu/dotnetdeploy/www_topswagcode_dev.pem;
ssl_certificate_key /home/ubuntu/dotnetdeploy/www_topswagcode_dev.key;

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
    try_files $uri $uri/ =404;
}
}

After I changed my Config I ran:

sudo service nginx restart 

When I type:

nginx -T

then there is a lot of types eg:

types { ....  }

Anyone know what is going on here?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

You have another copy of nginx already running. You should kill it manually before trying to restart nginx using systemctl (stop using service as this is deprecated and will be removed eventually).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-09-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。