1. 进入到 Nginx 文件夹目录,cmd开启命令行工具
start nginx
nginx -s reload
nginx -s stop // 将杀死nginx进程并退出,执行过程有可能会延迟
nginx -s quit
2. 进程查看
任务管理器 -> 进程 nginx.exe *32
3. 代理配置
conf/nginx.conf文件
server {
listen 8080;
server_name localhost;
location / {
root D:\web.sj\web.simulate\dist;
index login.html;
}
# 将http:localhost:8080/api/getList 代理到 http://192.168.0.1:80/getList 重写路径,去掉/api
location /api {
proxy_pass http://192.168.0.1:80;
rewrite "^/api/(.*)$" /$1 break;
}
# 等价于
# location /api/ {
# proxy_pass http://192.168.0.1:80/;
# }
# 参考链接: https://www.cnblogs.com/lianxuan1768/p/8383804.html
}