按使用场景分组,点击"复制"按钮一键复制命令
`nginx -v` / `nginx -V`
nginx -t
nginx -s reload
nginx -s stop
systemctl restart nginx
server { listen 80; server_name <domain>; }
root /var/www/<site>; index index.html;
location /api/ { ... }
location ~ .php$ { ... }
location /static/ { alias /data/static/; }
proxy_pass http://<backend>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
upstream <name> { server 10.0.0.1:8080; }
upstream <name> { server 10.0.0.1:8080 weight=3; server 10.0.0.2:8080; }
listen 443 ssl;
ssl_certificate <cert.pem>; ssl_certificate_key <key.pem>;
return 301 https://$host$request_uri;
gzip on; gzip_types text/css application/javascript;
`location ~* .(png