Nginx配置记录【例1】
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】的更多相关文章
- nginx配置样例
简单的nginx配置如下,包含了静态文件配置.websocket.socket.io的配置: user nobody; worker_processes 3; #master_process off; ...
- Nginx配置记录【例3】
C服务器,例: [root@82_www_db_2 conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf user nginx; work ...
- Nginx配置记录【例2】
B服务器,例: [root@localhost conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf user nginx; worker ...
- nginx配置记录
user www-data;worker_processes 1; error_log /var/log/nginx/error.log;pid /var/run/nginx.pid; events ...
- nginx 配置记录 上传文件大小 size client
cat nginx.conf worker_processes auto;events { worker_connections 1024;}http { include mime.types; de ...
- 在docker容器中如何自动生成配置文件(以nginx配置为例)
应用场景类似于多个域名要起多个容器,有些参数有些域名需要,有些域名不需要,或者参数的值不太一样,需要去对应的配置文件修改,不太灵活,如果通过变量的方式直接定义在Dockerfile文件中,需要哪些参数 ...
- 一些NGINX配置
一些nginx配置 使用独立目录, 然后include具体配置 gzip on for multi processers static file cache proxy pass 静态目录 or 文件 ...
- nginx配置反向代理或跳转出现400问题处理记录
午休完上班后,同事说测试站点访问接口出现400 Bad Request Request Header Or Cookie Too Large提示,心想还好是测试服务器出现问题,影响不大,不过也赶紧上 ...
- nginx https 配置样例
站点nginx https 配置模板 第一章 nginx 支持https 配置样例 其他 相关链接地址 第一章 nginx 支持https 配置样例 说明:https 段配置参数说明 Server 段 ...
随机推荐
- layui2.5 修改layuicms
雷哥layui2.5版本学习 学习地址: https://www.bilibili.com/video/av59813890/?p=30 注意: 修改layuicms时注意下面是缓存的js, < ...
- solr学习笔记-导入mysql数据
操作系统:LINUX CENTOS 6.7 solr安装目录:/usr/local/solr-6.1.0 1.准备工作: 1.1.创建数据表: CREATE TABLE `mytable` ( `id ...
- WPF贝塞尔曲线示例
WPF贝塞尔曲线示例 贝塞尔曲线在之前使用SVG的时候其实就已经有接触到了,但应用未深,了解的不是很多,最近在进行图形操作的时候需要用到贝塞尔曲线,所以又重新来了解WPF中贝塞尔曲线的绘制. 一阶贝塞 ...
- C#中的编译为什么不叫Compile而叫build
是因为Build包含了compile,build既compile了你自己的代码,又把你compile的Assembly和引用别人的Assembly放在一起buiid.
- 设置adb shell的环境变量
1.设置adb系统变量 adb D:\androidStudio\platform-tools;D:\androidStudio\tools 2.设置path系统变量 path D:\android ...
- JQuery——关于CDN(内容分发网络)
替代方案 如果您不希望下载并存放 jQuery,那么也可以通过 CDN(内容分发网络) 引用它. Staticfile CDN.百度.又拍云.新浪.谷歌和微软的服务器都存有 jQuery . 如果你的 ...
- arcgis 地图如何转到supermap平台
场景:客户使用arcmap配置好的地图数据,由于项目需要转换到超图平台.有如下几种思路供参考. 1. 使用arcmap生成地图缓存,supermap-iServer支持发布arcgis的地图缓存以及t ...
- postgres导入和导出
导出整个数据库: pg_dump -h 127.0.0.1 -U zhang mydb >mydb_dum.sql 导出某个表: pg_dump -h 127.0.0.1 -U zhang my ...
- UltraEdit中的特殊字符
以下特殊字符,可以在替换中用到, ^n--换行 ^t--Tab
- 如何卸载rpm
首先通过 rpm -q <关键字> 可以查询到rpm包的名字 或者rpm -qa|grep 关键字 然后 调用 rpm -e <包的名字> 删除特定rpm包 如果遇到依赖,无 ...