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; }

  

  

Nginx配置记录【例1】的更多相关文章

  1. nginx配置样例

    简单的nginx配置如下,包含了静态文件配置.websocket.socket.io的配置: user nobody; worker_processes 3; #master_process off; ...

  2. Nginx配置记录【例3】

    C服务器,例: [root@82_www_db_2 conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf user nginx; work ...

  3. Nginx配置记录【例2】

    B服务器,例: [root@localhost conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf user nginx; worker ...

  4. nginx配置记录

    user www-data;worker_processes 1; error_log /var/log/nginx/error.log;pid /var/run/nginx.pid; events ...

  5. nginx 配置记录 上传文件大小 size client

    cat nginx.conf worker_processes auto;events { worker_connections 1024;}http { include mime.types; de ...

  6. 在docker容器中如何自动生成配置文件(以nginx配置为例)

    应用场景类似于多个域名要起多个容器,有些参数有些域名需要,有些域名不需要,或者参数的值不太一样,需要去对应的配置文件修改,不太灵活,如果通过变量的方式直接定义在Dockerfile文件中,需要哪些参数 ...

  7. 一些NGINX配置

    一些nginx配置 使用独立目录, 然后include具体配置 gzip on for multi processers static file cache proxy pass 静态目录 or 文件 ...

  8. nginx配置反向代理或跳转出现400问题处理记录

    午休完上班后,同事说测试站点访问接口出现400 Bad Request  Request Header Or Cookie Too Large提示,心想还好是测试服务器出现问题,影响不大,不过也赶紧上 ...

  9. nginx https 配置样例

    站点nginx https 配置模板 第一章 nginx 支持https 配置样例 其他 相关链接地址 第一章 nginx 支持https 配置样例 说明:https 段配置参数说明 Server 段 ...

随机推荐

  1. centos 7 源码安装 mysql 5.6

    下载 mysql 安装包 $ wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.44.tar.gz # or $ curl -O ht ...

  2. 从入门到自闭之Python字典如何使用

    字典: 定义:dict dict = {"key":"value"} -- 键值对 作用:存储大量数据,数据和数据起到关联作用 所有的操作都是通过键来完成 键: ...

  3. oracle 重置密码(一般电网,国企需要的二级等保)

    oracle 10g,11g 可以查找以下,12c没有测试 一.查看profile配置并记录;二.在重置密码之前修改profile(PASSWORD_REUSE_MAX.PASSWORD_REUSE_ ...

  4. 剑指offer-数组中重复的数字-数组-python

    题目描述 在一个长度为n的数组里的所有数字都在0到n-1的范围内. 数组中某些数字是重复的,但不知道有几个数字是重复的.也不知道每个数字重复几次.请找出数组中任意一个重复的数字. 例如,如果输入长度为 ...

  5. N1考试必备词汇

    相次ぐ あいつぐ 淡い あわい 合間 あいま 渋い しぶい 相俟つ あいまつ 慌てよう あわてよう 明るい あかるい 安易過ぎる 明らか あきらか 用心 ようじん 悪事 あくじ 案の定 あんのじょう ...

  6. Zabbix 3.2.6使用注意事项

    1.如果需要使用zabbix自带的SMTP发送邮件,需要在安装前升级系统的curl到7.20版本以上 2.zabbix对接PHP 7.1版本,因为PHP 7.1类型强化,会在安装完成zabbix,登录 ...

  7. 简单了解TCP/IP与HTTP

    这种东西网上资源非常丰富,完全没有必要造轮子,更何况 这也不是你能造的啊,来 上连接 TCP/IP https://www.runoob.com/tcpip/tcpip-intro.html HTTP ...

  8. SpringMVC获取HttpClient 请求的数据

    package com.nnk.upstream.controller;import org.springframework.util.StreamUtils;import javax.servlet ...

  9. PAT Basic 1009 说反话 (20 分)

    给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出. 输入格式: 测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串.字符串由若干单词和若干空格组成,其中单词是由英文字母(大小 ...

  10. Mongodb文档查询

    MongoDB 查询数据的语法格式如下: db.collection.find(query, projection) query :可选,使用查询操作符指定查询条件 projection :可选,使用 ...