码迷,mamicode.com
首页 > 其他好文 > 详细

nginx对后端的目录进行反向代理

时间:2017-05-07 10:24:06      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:plone

nginx主配置文件

worker_processes 1;

error_log  /home/data/logs/nginx/error.log;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

worker_rlimit_nofile 65535;

events {
    use epoll;
    worker_connections  65535;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$http_host" "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" $http_x_forwarded_for ‘ 
                      ‘"$upstream_addr" "$upstream_status" "$upstream_response_time" "$request_time"‘;

    #log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
    #                  ‘$status $body_bytes_sent "$http_referer" ‘
    #                  ‘"$http_user_agent" "$http_x_forwarded_for"‘;

    #access_log  logs/access.log  main;
    access_log  /home/data/logs/nginx/access.log main;
    server_tokens off;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
	
	#--------------h1----------------
    upstream  plone {  
	   server 172.16.1.24:8080;    #重点
     }  

	
    #gzip  on;

    server_name_in_redirect off; 

    include vhosts/*.conf; #重点
   


}

nginx  vhosts里面的配置文件



[root@plone vhosts]# cat  plone.conf 

    server {
        listen       80;
        server_name  plone.sense.com.cn;
        access_log  /home/data/logs/nginx/plone_access.log main;
#        rewrite ^(.*)$  https://$host$1 permanent;
        location / {
                 proxy_set_header X-real-ip $remote_addr;
                 proxy_set_header Host $http_host;
                 proxy_set_header X-Forwarded-Scheme  $scheme;
                 proxy_pass   #重点 
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

}




#    server {
#        listen       443 ssl;
#        server_name  console.senseyun.com;
#	    access_log  /home/data/logs/nginx/ssl.console_senseyun.log main;
#		
#        ssl_certificate /opt/CA/senseyun.com_bundle.crt;
#        ssl_certificate_key /opt/CA/senseyun.com.key;
#
#
#       location ~^/ {
#                proxy_set_header X-real-ip $remote_addr;
#                 proxy_set_header Host $http_host;
#                proxy_set_header X-Forwarded-Scheme  $scheme;
#                proxy_pass http://console;
#       }
#
#        error_page   500 502 503 504  /50x.html;
#        location = /50x.html {
#            root   html;
#        }
#    }


本文出自 “砖家博客” 博客,请务必保留此出处http://wsxxsl.blog.51cto.com/9085838/1922736

nginx对后端的目录进行反向代理

标签:plone

原文地址:http://wsxxsl.blog.51cto.com/9085838/1922736

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!