Nginx 使用(server参数配置)

文件地址nginx/conf/Nginx.conf

 1 文件地址;nginx/conf/Nginx.conf
 2 
 3 [java] view plain copy
 4   server {# 服务名及配置,一个服务下可以有多个location 用来表示不同的反向代理  
 5       listen       80; # 端口号  
 6       server_name  localhost; #主机名,默认是本主机  
 7   
 8       #charset koi8-r;  
 9   
10       #access_log  logs/host.access.log  main;  
11   
12       location / { # /表示根目录,该配置表示Nginx默认打开/www下的index.html   
13           root   /www;  #根目录,该配置表示Nginx默认打开/www  
14           index  index.html index.htm; #若index.html 不存在,则打开index.htm  
15       }  
16 #添加jeeCms代理 npl 20160920  
17 location /jeeCms/ { # 过滤形如localhost:80/jeeCms/的url  
18     proxy_pass http://192.168.2.8:8070/jeeCms/;#转发至形如http://192.168.2.8:8070/jeeCms/的地址  
19         proxy_redirect off; # 关闭重定向  
20         proxy_set_header Host $host:$server_port;              
21         proxy_set_header X-Real-IP $remote_addr;  
22         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
23     }  
24     #添加ctp-war代理 npl 20160920  
25 location /ctp-war/ {# 过滤形如localhost:80/ctp-war/的url  
26     proxy_pass http://192.168.2.8:8020/ctp-war/; #转发至形如http://192.168.2.8:8070/ctp-war/的地址  
27         proxy_redirect off;# 关闭重定向  
28         proxy_set_header Host $host:$server_port;  
29         proxy_set_header X-Real-IP $remote_addr;  
30         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
31     }  
32 }  

猜你喜欢

转载自www.cnblogs.com/cangqinglang/p/9173300.html