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地址访问我本地的网站了,比如我 ...
随机推荐
- django admin后台接入tinymce并且支持图片上传
首先:下载tinymce 地址是https://www.tinymce.com/ 点击download 下载社区版本即可 接着:把压缩包内tinymce目录内的所有文件和文件夹复制到Django项目中 ...
- scrapy-splash抓取动态数据例子五
一.介绍 本例子用scrapy-splash抓取智能电视网网站给定关键字抓取咨询信息. 给定关键字:打通:融合:电视 抓取信息内如下: 1.资讯标题 2.资讯链接 3.资讯时间 4.资讯来源 二.网站 ...
- 安装ADT的时候,提示“Cannot complete the install because one or more required items could not be
今天在安装ADT的时候,提示: Cannot complete the install because one or more required items could not be found. S ...
- Netty利用ChannelGroup广播消息
在Netty中提供了ChannelGroup接口,该接口继承Set接口,因此可以通过ChannelGroup可管理服务器端所有的连接的Channel,然后对所有的连接Channel广播消息. Serv ...
- 饿了么ui添加事件
最近饿了么ui挺火,连美团都有项目组再用,刚好最近项目重构,就引入了进来,刚用上就发现一个大坑,在配合vue使用时,居然无法添加自定义事件 找了半天才发现原因是需要在事件后面加上 ‘’.native ...
- ubuntu14.04无法连接有线连接问题
在windows系统下关闭有线网卡的关机,自动唤醒功能即可
- 一款实现浏览实事的资讯平台app
一款实现浏览实事的资讯平台app 如有转载,请注明出处:http://blog.csdn.net/u012301841/article/details/46687447 github链接:https: ...
- js取消radio选中 反选
var radio=document.createElement("input");radio.type="radio";radio.onclick = fun ...
- FIS3项目构建
概述 FIS3采取了类似CSS语法一样的配置风格,易于理解与上手.FIS3 是面向前端的工程构建工具.解决前端工程中性能优化.资源加载(异步.同步.按需.预加载.依赖管理.合并.内嵌).模块化开发.自 ...
- Java包装类的常量池
Integer a=Integer.valueOf(100); Integer b=Integer.valueOf(100); System.out.println(a==b); Double d1 ...