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";
}
}工具说明
静的ファイル配信・リバースプロキシ・HTTPSリダイレクト・ロードバランシングに対応したnginx.conf設定コードをワンクリック生成するオンラインツール。
nginxconfig配置反向代理httpsweb server