博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx对后端的目录进行反向代理
阅读量:7048 次
发布时间:2019-06-28

本文共 2375 字,大约阅读时间需要 7 分钟。

nginx主配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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里面的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[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;
#        }
#    }
本文转自 小小三郎1 51CTO博客,原文链接:http://blog.51cto.com/wsxxsl/1922736,如需转载请自行联系原作者
你可能感兴趣的文章
nginx proxy_set_header设置、自定义header
查看>>
Linux进程管理
查看>>
分离编译
查看>>
AngularJS 1.X 重点知识详解一
查看>>
java用double和float进行小数计算精度不准确
查看>>
nagios学习笔记【4】--nrpe的安装和使用(转)
查看>>
C语言:可变参数列表
查看>>
shell 运算符
查看>>
grep
查看>>
我的友情链接
查看>>
Sniffer的使用
查看>>
cocos2d-x初探学习笔记(12)--图形绘制
查看>>
我的友情链接
查看>>
mysqldump 备份常用选项以及备份脚本
查看>>
es6箭头函数
查看>>
ESXi 5设置时间同步
查看>>
黑软与病毒区别
查看>>
Linux 1、2、3
查看>>
HTTP错误大全
查看>>
Linux多网卡绑定bonding
查看>>