static
server {
listen 80;
server_name example.com;
gzip on;
gzip_types text/plain text/css application/json application/javascript;
root /var/www/html;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}工具说明
Generador de configuración Nginx en línea compatible con servicio de archivos estáticos, proxy inverso, redirección HTTPS y balanceo de carga. Genera código nginx.conf con un clic.
nginxconfig配置反向代理httpsweb server