A服务器,例:

[root@localhost conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf

user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
worker_rlimit_nofile 65520;
include /usr/share/nginx/modules/*.conf;
events {
use epoll;
worker_connections 10240;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
#gzip 压缩传输
gzip on;
gzip_min_length 1k; #最小1K
gzip_buffers 16 64K;
#gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain application/x-javascript text/css application/xml application/javascript image/jpeg image/gif image/png;
gzip_vary on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
proxy_intercept_errors on;
proxy_redirect off;
proxy_set_header Host $host;
#proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 328k;
proxy_connect_timeout 90;
proxy_read_timeout 90;
proxy_send_timeout 90;
proxy_buffer_size 40k;
proxy_buffers 4 320k;
proxy_busy_buffers_size 640k;
proxy_temp_file_write_size 640k;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
}

[root@localhost conf.d]# pwd
/etc/nginx/conf.d
[root@localhost conf.d]# ls
cmsapit1.conf weixint1.conf ywxt-fz.conf

[root@localhost conf.d]# more cmsapit1.conf

\\ 访问 http://cmsapit1.abc.com 转发到 http://cmsapitest.abc.com:8079 的配置

server {
listen 80;
server_name cmsapit1.abc.com; location / {
proxy_set_header Host cmsapitest.abc.com;
#rewrite /(.+)$ /$1 break;
proxy_pass http://cmsapitest.abc.com:8079/; #域名+端口 } location = /favicon.ico {
log_not_found off;
access_log off;
} error_page 404 http://cmsapit1.abc.com;
error_page 500 502 503 504 http://cmsapit1.abc.com; }

[root@localhost conf.d]# cat weixint1.conf

server {
listen 80;
server_name weixint1.abc.com; location / {
root /var/www/ywxt;
try_files $uri $uri/ /index.html last;
index index.html index.htm;
}

location /api {
proxy_set_header Host fz.abc.com;
rewrite /api/(.+)$ /$1 break;
proxy_pass http://fz.abc.com;
#proxy_pass http://218.xxx.xxx.44:9993/;
} location /wxApi {
proxy_set_header Host api.weixin.qq.com;
rewrite /wxApi/(.+)$ /$1 break;
proxy_pass https://api.weixin.qq.com;
} location /bargainBaseUrl {
proxy_pass http://218.xxx.xxx.42:8078/;
} location = /favicon.ico {
log_not_found off;
access_log off;
} error_page 404 http://weixint1.abc.com/lw;
error_page 500 502 503 504 http://weixint1.abc.com/lw; }

  

[root@localhost conf.d]# more ywxt-fz.conf

upstream lwywfz {
ip_hash;
server 218.xxx.xxx.44:9993;
} server {
listen 80;
server_name fz.abc.com; location /lw {
proxy_pass http://lwywfz/lw;
} location = /favicon.ico {
log_not_found off;
access_log off;
} error_page 404 http://fz.abc.com/lw;
error_page 500 502 503 504 http://fz.abc.com/lw; }

  

  

最新文章

  1. [SVN Mac自带SVN结合新浪SAE进行代码管理]
  2. Linq中查询List组合相同值数量大于1
  3. Python的descriptor (2)
  4. PHP中::、->、self、$this操作符的区别
  5. Jordan Lecture Note-3: 梯度投影法
  6. WORDPRESS开发(一)自定义页面显示分类目录
  7. 08_android入门_android-async-http开源项目介绍及用法
  8. Android ContentProvider完整案例
  9. pycharm远程linux开发和调试代码
  10. angular4.0项目build发布后,刷新页面报错404
  11. 查看eclipse ADT SDK JDK版本号
  12. 在java中String类为什么要设计成final
  13. 100个Myeclipse6.5免费注册码
  14. Java读取Excel的另一种方法
  15. 第二章 Android系统与嵌入式开发
  16. 二、core abp 数据库迁移
  17. Smack类库详细介绍
  18. java.lang.string split 以点分割字符串无法正常拆分字符串
  19. SQL一些问题
  20. 05_zookeeper_原生API使用1(更新)

热门文章

  1. MySQL_入手<一>增--数据库操作
  2. python网络爬虫(6)爬取数据静态
  3. 稀疏矩阵三元组快速转置(转poklau123写的很清楚)
  4. HTML和CSS学习
  5. wex5 file文件存储
  6. 一个页面两个div(一个柱状图或者折线图一个饼图)
  7. go语言的学习之路
  8. Web前端开发解耦1
  9. Linux下安装配置启动RabbitMQ
  10. Spring Boot热部署插件