若按如下更改,可以解决动态域名的问题,根目录反代也正常,但两个二级目录的反代会提示“重定向次数过多”而无法打开页面。
- #PROXY-START/
- resolver 8.8.8.8 valid=30s;
- set $qh_ddns salo.vicp.net;
- location ~* \.(gif|png|jpg|css|js|woff|woff2)$
- {
- proxy_pass http://$qh_ddns:8090;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header REMOTE-HOST $remote_addr;
- expires 12h;
- }
- location /
- {
- proxy_pass http://$qh_ddns:8090;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header REMOTE-HOST $remote_addr;
-
- add_header X-Cache $upstream_cache_status;
-
- #Set Nginx Cache
-
- add_header Cache-Control no-cache;
- }
- location /admin
- {
- proxy_pass http://$qh_ddns:8090/admin/;
- }
- location /member
- {
- proxy_pass http://$qh_ddns:8090/member/;
- }
- #PROXY-END/
复制代码 |