ngx-gateway/ngx/etc/conf.d/model/site.cnf

38 lines
844 B
Plaintext
Raw Normal View History

2024-02-04 21:10:09 +08:00
upstream {name} {
2024-02-04 20:39:43 +08:00
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;
2024-02-04 21:10:09 +08:00
proxy_pass http://{name};
2024-02-04 20:39:43 +08:00
}
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;
# }
}