首次部署时健康检查一直失败——容器内nginx只listen了IPv4(0.0.0.0:80), 但/etc/hosts里localhost解析到::1在前,wget http://localhost/因而连不上。 补上 listen [::]:80 双栈监听解决。部署脚本那边也同步改成直连127.0.0.1, 避免再依赖localhost的解析顺序。
22 lines
490 B
Nginx Configuration File
22 lines
490 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Tinode webapp uses hash-based client-side routing, so any unknown path
|
|
# can safely fall back to index.html.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location /umd/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
location /img/ {
|
|
add_header Cache-Control "public, max-age=86400";
|
|
}
|
|
}
|