环境
nginx-1.15.3 windows版本
阿里云windows2012服务器
操作步骤
- 解压nginx在D:\tools\nginx目录下。;
- 修改D:\tools\nginx\conf\nginx.conf;
worker_processes 1;
http {
#map块为websocket必须配置
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server localhost:8081;
}
server {
listen 80;
#配置websocket地址
location /system/indexWebsocket {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
- 启动nginx ,dos下进入D:\tools\nginx,执行start nginx命令启动nginx,不要双击nginx.exe图标,这样会导致很多问题;
nginx常用命令
停止 nginx -s stop
退出 nginx -s quit
重启加载配置 nginx -s reload 这个命令在windows下不起作用
启动 start nginx