我无法重新启动 nginx,因为我收到 [emerg] 6594#6594: bind() to 0.0.0.0:443 failed (98: Address already in use)
。多服务器 block 如何工作?如果没有临时服务器 block ,我的配置工作正常。
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name api.example.com;
location / {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 443;
server_name staging-api.example.com;
location / {
proxy_pass http://localhost:3002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
最佳答案
netstat -anp | grep :443
chgeck哪个应用程序接管了443端口,如果不需要,杀死它然后重新启动nginx
关于linux - 一台 Linux 服务器中的 nginx 2 服务器 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52569558/