配置文件
Linux
vi /etc/nginx/nginx.conf
windows
\nginx-1.24.0\conf\nginx.conf
代理地址
使用场景:前端处理跨域问题
使用: proxy_pass http://127.0.0.1:8080;
server {
listen 80;
server_name www.123.com;
location / {
proxy_pass http://127.0.0.1:8080;
index index.html index.htm index.jsp;
}
}
代理本地文件
使用场景:部署前端代码
使用:root E:\广林项目\phmWeb\dist; 指向具体目录
server {
listen 8000;
listen somename:8080;
server_name somename alias another.alias;
location / {
root E:\广林项目\phmWeb\dist;
index index.html index.htm;
}
}