upstream {name} { server localhost:{port} weight=1; } # ===================配置=================== # 带加密的 web server { listen 80; listen 443 ssl http2; charset utf-8; server_name {server_name}; # 日志 access_log ./conf.d/{name}/access.log; error_log ./conf.d/{name}/error.log; # location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_redirect off; proxy_pass http://{name}; } location = /favicon.ico { log_not_found off; access_log off; root conf/path/to/site; } # 自动重定向 80 到 443 开启 SSL # if ( $scheme = http ){ # return 301 https://$server_name$request_uri; # } }