安装windows版nginx可以做简单的服务代理/静态资源访问
下载地址:http://www.ddooo.com/softdown/29113.htm
下载后直接解压
点击nginx.exe运行,启动窗口一闪而过,查看后台进程
浏览器输入127.0.0.1可进入首页,启动成功
服务配置:
配置文件: \nginx\conf\nginx.conf
监听80端口: listen:80
代理本地ip: server_name 127.0.0.1
请求路径: location / 或者 location /files/
跳转路径 : root D:/xmgl/
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 10.200.5.19;
location / {
root html;
index index.html index.htm;
}
location /my_controller{
proxy_pass http://127.0.0.1:8080/my_controller;
proxy_cookie_path /my_controller /my_controller;
proxy_set_header Cookie $http_cookie;
}
location /files/ {
root D:/xmgl/;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
如上配置, 在浏览器输入 10.200.200.19:80/files/11.jpg 或者 10.200.200.19/files/11.jpg可直接访问D:/xmgl/11.jpg (默认端口:80,如果修改了监听端口,就必须加上端口号)
在nginx目录下创建 stop.bat 停止服务脚本
@echo off
title kill nginx service
tasklist | find /i "nginx.exe" || exit
taskkill /im nginx.exe /f