启动
nginx -c /etc/nginx/nginx.conf运维
启停命令、反向代理、gzip 与静态缓存配置。 — 共 11 条
共 11 条代码片段
nginx -c /etc/nginx/nginx.confnginx -tnginx -s reloadnginx -s reopennginx -s stopps -ef | grep nginx/etc/nginxgzip on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
gzip_vary on;location /api/ {
proxy_pass http://127.0.0.1:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location / {
try_files $uri $uri/ /index.html;
}location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}