1
我需要:nginx的反向代理環
- 點site.com我site.github.io(的作品)
- 點site.com/anything文件系統/現場/ DIST(即作品)
- 點site2.com到site.com文件系統/根/ DIST(不工作,此處顯示site.github.io)
site.com.conf
server {
listen 80;
server_name site.com;
location =/{
proxy_pass http://site.github.io;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location/{
root /site/dist;
try_files $uri /index.html;
}
}
site2.com.conf
server {
listen 80;
server_name site2.com;
proxy_set_header Host site.com;
proxy_set_header X-Forwarded-For $remote_addr;
location/{
proxy_pass http://127.0.0.1/$request_uri;
}
}