1.下载nginx
nginx: download

选择自己需要的版版本下载下来
2.解压文件修改ngixn.conf配置文件

events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;sendfile on;
keepalive_timeout 65;server {
listen 9000;
server_name localhost;
client_max_body_size 50M;
location / {
proxy_pass http://172.16.1.3:9000;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
3.点击nginx.exe启动

或者打开nginx的目录输入cmd回车

输入start nginx

4.常用命令
windows
服务启动
linux根据配置文件启动
./nginx -c /usr/local/nginx/conf/nginx.conf
window在cmd中启动
start nginx
服务停止
#立即停止
nginx -s stop
或者
平滑停止
nginx -s quit
服务重启
nginx -s reload
linux
启动 Nginx
./nginx
 停止 Nginx
./nginx -s stop
 安全退出 Nginx
./nginx -s quit
 重新加载 Nginx 配置文件
./nginx -s reload
 查看 Nginx 进程
ps aux|grep nginx


















