nginx 的用法
一 安装
安装请参看:https://blog.csdn.net/Janson_Lin/article/details/107529341
1, 下载稳定版 2, 双击运行exe,输入localhost 3,若是没有出现ngnix页面,可以修改conf文件下的nginx.conf文件的端口
start E:\nginx-1.10.2\nginx.exe -c E:\nginx-1.10.2\conf\nginx-2.conf
Access to fetch at 'http://localhost:3000/' from origin 'http://localhost:8083"
#在server中做如下修改
server {
listen 8081; #这里是nginx监听端口
server_name http://www.forus616.cn;
location / {
proxy_pass http://www.forus616.cn:4200;
#这个是代理,说明这个代理服务器的默认路径/是 http://www.forus616.cn:4200
}
location /api {
proxy_pass http://www.beauty.com/api;
#这个是代理,说明这个代理服务器的路径/api是http://www.beauty.com/api
}
}
查看多少个nginx : tasklist /fi "imagename eq nginx.exe
运行命令: taskkill /f /t /im nginx.exe 关闭nginx其他服务,这样才能彻底关闭
查看修改成功了?: nginx -t -c F:\nginx-1.22.0\conf\nginx.conf
nginx -s stop ,nginx -s quit
常见的错误:
(1)端口号被占用
(2)nginx文件夹路径含中文

浙公网安备 33010602011771号