1、下載Nginx並解壓到服務器。
2、修改配置文件:conf/nginx.conf。
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