nginx相关

1.在Linux中安装nginx

(1)./configure --prefix=/usr/local/nginx
(2)yum -y install pcre-devel
(3)yum -y install zlib-devel
(4)yum install gcc

2.配置文件

请求:

location /waiweihunter {
  client_max_body_size 100m;
  proxy_connect_timeout 1200;
  proxy_send_timeout 1200;
  proxy_read_timeout 1200;
  root /home/ralf/waiweihunter189/webapps;
  proxy_pass http://127.0.0.1:8099;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header REMOTE-HOST $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

转发:

upstream neiwei_servers {
  server 127.0.0.1:8080;
  server 127.0.0.1:8091 backup;
}

3.启动:

nginx -c /usr/local/nginx/conf/nginx.conf

4.重启:

nginx -s reload(stop-直接退出、quit-当前请求处理后退出、reload-重新加载、reopen-重新打开日志文件)

 

posted @ 2018-06-06 11:05  smj1990  阅读(106)  评论(0编辑  收藏  举报