Windows 启动nginx
环境:Windows 7
nginx:1.14.2
1 配置文件路径
\nginx-1.14.2\conf\nginx.conf
2 启动
\nginx-1.14.2\start nginx
3 重载 当修改配置文件后使用
\nginx-1.14.2\nginx.exe -s reload
4 stop快速停止,并不保存相关信息 quit有序停止,会保存相关信息
\nginx-1.14.2\nginx.exe -s stop|quit
5 查看版本
\nginx-1.14.2\nginx.exe -v
nginx反向代理
打开配置文件:\nginx-1.14.2\conf\nginx.conf
upstream backend{
//代理IP
server 127.0.0.1:8080;
server 127.0.0.1:8081;
}
server {
listen 80; //监听端口
server_name localhost; //server名称
location / {//'/'表示拦截所有
proxy_pass http://backend; //所有请求转发到http://backend
}
}
本文介绍在Windows环境下如何配置与启动Nginx,包括配置文件路径、启动、重载、停止方法及查看版本。同时,详细展示了如何设置Nginx作为反向代理,通过修改配置文件实现请求转发。
6478

被折叠的 条评论
为什么被折叠?



