1、下载Nginx并解压到服务器
2、修改配置文件
server { listen 6090;#数据端口与arcserver的6080相近 server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #设置允许跨域 add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; if ($request_method = 'OPTIONS') { return 204; } root html; index index.html index.htm; } location /data { #设置允许跨域 add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; if ($request_method = 'OPTIONS') { return 204; } alias E:/VearthData/;#磁盘的目录路径 autoindex on; #是否开启目录浏览.生产环境为on,部署环境建议为off }
3、创建脚本文件,各自将文件后缀改为*.bat
启动脚本:
start nginx
pause
停止脚本:
nginx -s stop
pause
重启脚本:
nginx -s reload
pause