Nginx 学习笔记

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
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值