1.下载安装
下载地址:
nginx: download
解压即可。注:一般不要放在有中文的路径下
2.修改配置
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 512;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name www.example.com;
charset utf-8;
location / {
proxy_pass http://localhost:8080;
}
}
server {
listen 80;
server_name www.example.com;
charset utf-8;
location / {
proxy_pass http://localhost:8081;
}
}
}
3.启动
在命令窗口输入
start nginx
4.查看是否成功
tasklist /fi "imagename eq nginx.exe"
5.关闭
nginx.exe -s quit
或
nginx.exe -s stop