nginx配置事例
#user nobody;
worker_processes 4; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} #非http请求配置
stream {
#资源数据库
server {
listen 3308;
tcp_nodelay on;
proxy_responses 1;
proxy_connect_timeout 30s;
proxy_timeout 30s;
proxy_pass 192.168.0.2:3306;
}
#开发数据库
server {
listen 3307;
tcp_nodelay on;
proxy_responses 1;
proxy_connect_timeout 30s;
proxy_timeout 30s;
proxy_pass 192.168.0.6:3306;
}
#MongoDB
server {
listen 27017;
tcp_nodelay on;
proxy_responses 1;
proxy_connect_timeout 30s;
proxy_timeout 30s;
proxy_pass 192.168.0.6:27017;
}
#redis
server {
listen 6380;
tcp_nodelay on;
proxy_responses 1;
proxy_connect_timeout 30s;
proxy_timeout 30s;
proxy_pass 192.168.0.6:6379;
}
} #http请求配置
http {
include mime.types;
default_type application/octet-stream; #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; sendfile on;
#tcp_nopush on; #keepalive_timeout 0
#这个参数表示http连接超时时间,默认是65s。要是上传文件比较大,在规定时间内没有上传完成,就会自动断开连接!所以适当调大这个时间。
keepalive_timeout 100; gzip off;
#gzip on;
#gzip_min_length 1k;
#gzip_buffers 4 16k;
#gzip_comp_level 4;
#gzip_types text/css text/xml application/javascript;
#gzip_vary on; client_header_timeout 120s; #调大点
client_body_timeout 120s; #调大点
client_max_body_size 100m; #主要是这个参数,限制了上传文件大大小 ###########################端口80配置#####################################
server {
listen 80;
server_name 180.76.162.179; #农业调查图形化
location /nysurvey/{
root /usr/local/nginx/html;
}
#创业企业调查图形化
location /survey/{
proxy_pass http://192.168.0.5:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; }
#视频分析demo
location /videoAnalysis/{
proxy_pass http://192.168.0.5:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; }
#舆情demo
location /yuqing/{
proxy_pass http://192.168.0.5:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; }
# 智能写作demo
location /aiwritting/{
proxy_pass http://192.168.0.5:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; } #媒体云cms
location /media_cms/ {
proxy_pass http://192.168.0.5:8081;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
} #媒体云user
location /media_user/ {
proxy_pass http://192.168.0.5:8083;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#媒体云topic
location /media_topic/ {
proxy_pass http://192.168.0.5:8084;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#媒体云sso
location /sso/ {
proxy_pass http://192.168.0.5:8082;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#媒体云daily
location /daily/ {
proxy_pass http://192.168.0.5:8086;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#媒体云analysis
location /analysis/ {
proxy_pass http://192.168.0.5:8087;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#媒体云analysis_file
location /analysis_file/ {
proxy_pass http://192.168.0.5:8089;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#媒体云aimedia_server
location /aimedia_server/ {
proxy_pass http://192.168.0.5:8088;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#aidemo
location /aidemo/ {
proxy_pass http://192.168.0.5:8088;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# proxy_buffers 4 32k;
# proxy_temp_file_write_size 64k;
}
#智能媒资库前置测试项目
location /standard/{
proxy_pass http://192.168.0.5:8088;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; }
#财富三期的接口
location /edwFront/{
proxy_pass http://192.168.0.6:8080/edwFront/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; }
#公司门户网站首页
location /{
proxy_pass http://192.168.0.5:8088/tjzm_corp/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host; } #百度云nexus3
location /nexus/{
proxy_pass http://192.168.0.2:8081/nexus/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
# ###########################端口8090配置#####################################
server {
listen 8090;
# listen somename:8080;
server_name 180.76.162.179; location / {
# proxy_redirect off;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.0.2:8090;
proxy_connect_timeout 1;
proxy_send_timeout 30;
proxy_read_timeout 60; } #crapapi接口
location /crapapi {
proxy_pass http://192.168.0.2:8080/crapapi;
proxy_connect_timeout 1;
proxy_send_timeout 30;
proxy_read_timeout 60;
}
} ###########################端口8081配置#####################################
# server {
# listen 8081;
# listen somename:8080;
# server_name 180.76.162.179;
#百度云nexus3
# location /{
# proxy_pass http://192.168.0.2:8081/;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $remote_addr;
# proxy_set_header WL-Proxy-Client-IP $proxy_add_x_forwarded_for;
# proxy_set_header Host $host;
# }
# } ###########################端口81配置#####################################
server {
listen 81;
server_name 180.76.162.179;
client_max_body_size 1024M; #svn配置
location /svn {
proxy_pass http://192.168.0.2:81;
}
location / {
return 404;
}
} # HTTPS server
#
server {
# listen 80;
listen 443 ssl;
server_name www.teejo.com.cn; ssl_certificate /usr/local/nginx/ssl/teejo.com.cn.crt;
ssl_certificate_key /usr/local/nginx/ssl/teejo.com.cn.key; ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on; #微信小程序验证文件 add by jiangyx 2018-03-28
location /OS1vOzd93S.txt{
root /usr/local/nginx/html/weixin/;
} location /favicon.ico{
root /usr/local/nginx/html/weixin/;
} #location /*\.(txt|ico)$ {
# root /usr/local/nginx/html/weixin/;
#} # https 访问
location / {
#root html;
# index index.html index.htm;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.0.5/;
}
} }
nginx配置事例的更多相关文章
- nginx配置反向代理或跳转出现400问题处理记录
午休完上班后,同事说测试站点访问接口出现400 Bad Request Request Header Or Cookie Too Large提示,心想还好是测试服务器出现问题,影响不大,不过也赶紧上 ...
- Windos环境用Nginx配置反向代理和负载均衡
Windos环境用Nginx配置反向代理和负载均衡 引言:在前后端分离架构下,难免会遇到跨域问题.目前的解决方案大致有JSONP,反向代理,CORS这三种方式.JSONP兼容性良好,最大的缺点是只支持 ...
- Windows下Nginx配置SSL实现Https访问(包含证书生成)
Vincent.李 Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...
- Nginx 配置简述
不论是本地开发,还是远程到 Server 开发,还是给提供 demo 给人看效果,我们时常需要对 Nginx 做配置,Nginx 的配置项相当多,如果考虑性能配置起来会比较麻烦.不过,我们往往只是需要 ...
- Nginx配置详解
序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HTTP服务器,也 ...
- Nginx配置Https
1.申请证书: https://console.qcloud.com/ssl?utm_source=yingyongbao&utm_medium=ssl&utm_campaign=qc ...
- nginx配置为windows服务中的坑
网上搜索“nginx 配置为windows服务”,很容易搜索到使用windows server warpper来配置,于是按照网上的方法我从github上的链接下载了1.17版本,前面都很顺利,很容易 ...
- 【nginx配置】nginx做非80端口转发
一个场景 最近在使用PHP重写一个使用JAVA写的项目,因为需要查看之前的项目,所以要在本地搭建一个Tomcat来跑JAVA的项目.搭建成功后,因为Tomcat监听的端口是8080,因此,访问的URL ...
- Apache、nginx配置的网站127.0.0.1可以正常访问,内外网的ip地址无法访问,谁的锅?
最近做开发,发现一个比较尴尬的问题.因为我是一个web开发者,经常要用到Apache或者nginx等服务器软件,经过我测试发现,只要我打开了adsafe,我便不能通过ip地址访问我本地的网站了,比如我 ...
随机推荐
- Python 爬取外文期刊论文信息(机械 仪表工业)
NSTL国家科技图书文献中心 2017 机械 仪表工业 所有期刊论文信息 代码比较随意,不要介意 第一步,爬取所有期刊链接 #coding=utf-8 import time from se ...
- 【笔记】js Array.prototype.slice.call(arguments) 将函数的参数转换为数组方法的见解
我们知道函数里面的参数实际上是一个以数组形式储存的对象 但它并非一个数组 如果我们要将它转换为数组可以调用Array.prototype.slice() 这个方法 分析一下这个方法: Array.pr ...
- 2017.12.11SimpleDateFormat的线程安全性讨论
转载来自:http://blog.csdn.net/zxh87/article/details/19414885 1.结论 DateFormat和SimpleDateFormat都不是线程安全的.在多 ...
- JAVA基础(10)——IO、NIO
转载:http://blog.csdn.net/weitry/article/details/52964948 JAVA基础系列规划: JAVA基础(1)——基本概念 JAVA基础(2)——数据类型 ...
- Java补漏(一)
第一章前言 在学长的建议下,为了弥补之前学Java漏下的或者不是非常清楚的知识点,买了本蛮好的教科书-<Java学习笔记(JDK6)>,正式又一次学习.为了记下一些让我恍然大悟的知识 ...
- 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-如何修改某个轴的数值单位
在某个轴上双击,切换到Settings,然后可以再Unit中修改为角度,弧度,mm 更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/aceta ...
- JMeter 十:录制脚本--使用bodboy
1. 下载bodboy 下载地址:http://www.badboy.com.au/download 这里填写完基本信息,点击下方的Continue即可跳转到下载页面. 任选一个version,点击后 ...
- 导出oracle 到 mysql的解决办法
导出oracle 到 mysql的解决办法 使用sqluldr2 命令如下sqluldr2 USER=weibh/1234@dydb file=c:\1.txt sql=sql.sql FORMA ...
- 《The Story of My Life》Introductiom - A Journey Of Discovery
"I do not object to harsh criticism," said Helen Keller, "so long as I am treated lik ...
- 【Python】学习笔记十一:文件I/O
文件I/O是Python中最重要的技术之一,在Python中对文件进行I/O操作是非常简单的. 1.打开文件 语法: open(name[, mode[, buffering]]) 1.1文件模式 1 ...