因为这个块可以很好地进行健康检查:
server {
listen 80 default_server;
location /health-check {
access_log off;
return 200;
add_header Content-Type text/plain;
}
}我不确定这是否会在使用相同端口的其他服务器块上导致任何问题,例如:
server {
listen 80 my-domain.com;
...
...
}上面的服务器模块还能工作吗?或者该服务器标签不是可加的?
发布于 2020-08-27 16:38:46
**you not user duplicate server name or ip/
diffent serve block same port can not run
you give server name in config block
**
server {
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
}你可以使用这个工具https://www.digitalocean.com/community/tools/nginx来生成你的nginx配置
https://stackoverflow.com/questions/63612182
复制相似问题