在nginx.exe的目录下打开命令提示符
start nginx
nginx -s reload
taskkill /im nginx.exe /f
taskkill /f /t /im nginx.exe
nginx -s stop
nginx -s quit
tasklist /fi "imagename eq nginx.exe"
netstat -ano | findstr 30090
样例server模块
server {
listen 9003;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /t1 {
proxy_pass http://www.qw1213.com/t1;#随意编写的ip只做说明
}
}
1、静态资源的部署
静态资源可以直接部署在\nginx-1.22.0\html目录下
例如:\nginx-1.22.0\html/h5/demo.html
这样访问路径为:http://localhost:9003/h5/demo.html
意为:nginx在html下部署了静态资源,这些静态资源通过localhost:9003代理出去(此时本机是是真实部署了服务并对外发布的–》即这些本机部署的静态资源)
2、反向代理的理解
通过配置server块,来监听本机的某个端口,代理本机端口的地址到实际地址
原本访问的http://www.qw1213.com/t1/demo.html,代理到本机端口后,本机访问http://localhost:9003//t1/demo.html即可(此时本机只有nginx的监听域名为localhost,9003端口号的服务,实际是代理后的远程机提供的实际服务,本机只做监听和转发)
Windows本地Nginx部署WEB项目:https://blog.csdn.net/Pointer_Sky/article/details/107983856