Created
March 24, 2018 12:42
-
-
Save inhere/327bb55f7aba4ad8833e0830f0341b56 to your computer and use it in GitHub Desktop.
nginx 配置反向代理
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream frontends { | |
server 127.0.0.1:8088; # server 监听的ip:port | |
} | |
server { | |
listen 80; | |
server_name xxx.com www.xxx.com; | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_pass http://frontends; | |
} | |
# 静态资源交由nginx管理 | |
location /static { | |
root /www/xxx; # site 的根目录 | |
expires 1d; | |
add_header Cache-Control public; | |
access_log off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment