配置Nginx
负载地址: http://localhost:88
配置文件
1 worker_processes 1; 2 3 events { 4 worker_connections 1024; 5 } 6 7 8 http { 9 include mime.types; 10 default_type application/octet-stream; 11 12 sendfile on; 13 14 keepalive_timeout 65; 15 16 upstream tomcatServer{ 17 server 124.0.0.113:8080 weight=2; 18 server 124.0.0.113:8081 weight=1; 19 } 20 21 server { 22 listen 88; 23 server_name localhost; 24 25 location / { 26 proxy_pass http://tomcatServer; 27 } 28 error_page 500 502 503 504 /50x.html; 29 location = /50x.html { 30 root html; 31 } 32 } 33 34 }
1.启动nginx
切换到nginx解压目录下,输入命令 nginx.exe 或者 start nginx ,回车即可
2.重启nginx
当我们修改了nginx的配置文件nginx.conf 时,不需要关闭nginx后重新启动nginx,只需要执行命令 nginx -s reload 即可让改动生效
3.关闭nginx
(1)输入nginx命令 nginx -s stop(快速停止nginx) 或 nginx -s quit(完整有序的停止nginx)
(2)使用taskkill taskkill /f /t /im nginx.exe
原创文章,转载请说明出处,谢谢合作