博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
其他大神的配置 nginx 配置参考
阅读量:6250 次
发布时间:2019-06-22

本文共 16552 字,大约阅读时间需要 55 分钟。

hot3.png

`

user nginx nginx; worker_processes 2;

#error_log logs/error.log; error_log logs/error.log notice; #error_log logs/error.log info;

pid logs/nginx.pid; google_perftools_profiles /tmp/tcmalloc; worker_rlimit_nofile 65535;

events { worker_connections 65535; use epoll; }

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" "$request_time" "$request_body"';#access_log  logs/access.log  main;sendfile        on;tcp_nopush      on;tcp_nodelay     on;server_tokens   off;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 30m;client_body_buffer_size 1024k;#keepalive_timeout  0;keepalive_timeout  65;geoip_country /setup/nginx/conf/GeoIP.dat;proxy_connect_timeout   60;proxy_send_timeout      60;proxy_read_timeout      60;proxy_buffer_size       256k;proxy_buffers           8 256k;proxy_busy_buffers_size 256k;proxy_temp_file_write_size 256k;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;

gzip on; gzip_min_length  5k; gzip_buffers     16 8k; gzip_http_version 1.1; gzip_comp_level 6; gzip_types application/javascript text/plain text/css text/js application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_vary on; gzip_proxied any;  underscores_in_headers on;   upstream testd.skg.com {

server 10.24.167.199:8085 weight=100 max_fails=3 fail_timeout=30s; }

upstream testlogin.skg.com { server 10.24.167.199:8085 weight=100 max_fails=3 fail_timeout=30s; }

upstream testskg.skg.com { server 10.24.167.199:8085 weight=100 max_fails=3 fail_timeout=30s; }

upstream testo.skg.com { server 10.24.167.199:8089 weight=100 max_fails=3 fail_timeout=30s; }

upstream testwap.skg.com { server 10.24.167.199:8088 weight=100 max_fails=3 fail_timeout=30s; }

server {    listen       80;    server_name  test.tatatoutiao.com;    underscores_in_headers on;    #charset koi8-r;    access_log  logs/test.tatatoutiao.com.access.log  main;    location / {         index  index.html index.htm index.jsp;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;         proxy_pass http://10.24.167.199:8080;                }       }          server {    listen       80;    server_name  testwap.tatatoutiao.com;    #charset koi8-r;    access_log  logs/testwap.tatatoutiao.com.access.log  main;    #location  / {     #    root /setup/nginx/tata;      #   index  index.htm index.html;       #  access_log off;        #        }    location / {         index  index.html index.htm index.jsp;         proxy_pass http://10.24.167.199:8080;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }       }

server { listen 80; server_name testapi.tatatoutiao.com ;

#charset koi8-r;        access_log  logs/testapi.tatatoutiao.com.access.log  main;        location / {         index  index.html index.htm index.jsp;         proxy_pass http://10.24.167.199:8082;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }       }

server { listen 80; server_name testadmin.tatatoutiao.com;

#charset koi8-r;    access_log  logs/testadmin.tatatoutiao.com.access.log  main;    location / {         index  index.html index.htm index.jsp;         proxy_pass http://10.24.167.199:8083;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }	} server {    listen       80;    server_name  lifetest.skg.com;    underscores_in_headers on;    #charset koi8-r;    access_log  logs/lifetest.skg.com.access.log  main;    location / {         index  index.html index.htm index.jsp;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;         proxy_pass http://10.24.167.199:8080;                }       }          server {    listen       80;    server_name  lifetestwap.skg.com;    #charset koi8-r;    access_log  logs/lifetestwap.skg.com.access.log  main;    #location  / {     #    root /setup/nginx/tata;      #   index  index.htm index.html;       #  access_log off;        #        }   location  /bbswx/ {        index  index.html index.htm index.jsp;        proxy_pass   http://10.24.167.199:8080;        proxy_set_header Host $host;        proxy_set_header X-Forward-For $remote_addr;        proxy_set_header X-Real-IP $remote_addr;        add_header From m.skg.com;        proxy_cookie_path /bbswx/   /;        proxy_set_header Cookie $http_cookie;                }  location  /styles/bbswx/ {       index  index.html index.htm index.jsp;        client_max_body_size    100m;        proxy_pass   http://10.24.167.199:8080;        proxy_set_header Host $host;                proxy_set_header X-Forward-For $remote_addr;        proxy_set_header X-Real-IP $remote_addr;                 }  location  /scripts/bbswx/ {       index  index.html index.htm index.jsp;        client_max_body_size    100m;        proxy_pass   http://10.24.167.199:8080;        proxy_set_header Host $host;                proxy_set_header X-Forward-For $remote_addr;        proxy_set_header X-Real-IP $remote_addr;                 }    location / {         index  index.html index.htm index.jsp;         proxy_pass http://10.24.167.199:8080;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }       }

server { listen 80; server_name lifetestapi.skg.com ;

#charset koi8-r;        access_log  logs/lifetestapi.skg.com.access.log  main;        location / {         index  index.html index.htm index.jsp;         proxy_pass http://10.24.167.199:8082;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }       }

server { listen 80; server_name lifetestadmin.skg.com;

#charset koi8-r;    access_log  logs/lifetestadmin.skg.com.access.log  main;    location / {         index  index.html index.htm index.jsp;         proxy_pass http://10.24.167.199:8083;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }	}server {    listen       80;    server_name testskg.skg.com;     #charset koi8-r;    if ( $request_uri ~* ^/index\.htm$ )       {        rewrite  ^/index\.htm$   http://testskg.skg.com permanent;		}           #登录页面验证码从后端动态获取    location = /generateImage.html {      proxy_pass http://testd.skg.com/generateImage.html;     }    #location ^~ /scripts/     #  {      #root /usr/local/nginx/html/;      #access_log off;       #   }    #location ^~ /styles/     #   {     # root /usr/local/nginx/html/;     # access_log off;      #  }   location = /category/ {      root /usr/local/nginx/html/category;      index  index.htm index.html category.html category.htm;      access_log off;       if  (!-e $request_filename) {            proxy_pass   http://testskg.skg.com;              }        }   location ~* \.(css|js)$    {      root /usr/local/nginx/html/;      access_log off;      expires 1h;    }    location / {      root /usr/local/nginx/html;   index  index.htm index.html;         if  (!-e $request_filename) {               proxy_pass   http://testskg.skg.com;	              }          }		     location /storefront/member/toLogin.html {            rewrite . https://testlogin.skg.com/storefront/member/toLogin.html;    }  }       #   location / {   #     root   html;   #     index  index.html index.htm index.jsp;   #     client_max_body_size    100m;   #     proxy_pass   http://testskg.skg.com;   #     proxy_set_header Host $host;	   #     proxy_set_header X-Forward-For $remote_addr;   #     proxy_set_header X-Real-IP $remote_addr;   #             }  # } server {    listen       80;    server_name testwap.skg.com ;     #charset koi8-r;    #access_log  logs/host.access.log  main;#rewrite "^/product\/([0-9]{15}).htm/?$" http://testwap.skg.com/product/$1.html permanent;  #rewrite "^/category\/([a-z-A-Z]+)_([a-z-A-Z]+).htm/?$" http://testwap.skg.com/category/$1_$2.html permanent;    location  /bbswx/ {        #root   html;      #  index  index.html index.htm index.jsp;      #  client_max_body_size    100m;      #  proxy_pass   http://10.24.167.199:8080;		#proxy_cookie_path /bbswx/ /;		#proxy_set_header Cookie $http_cookie;      #  proxy_set_header Host $host;	      #  proxy_set_header X-Forward-For $remote_addr;      # proxy_set_header X-Real-IP $remote_addr;     if ($host ~* testwap.skg.com) {            rewrite ^/(.*)$ http://lifetestwap.skg.com/$1 permanent;                                }                }  location  /styles/bbswx/ {         #root   html;        # index  index.html index.htm index.jsp;        # client_max_body_size    100m;        # proxy_pass   http://10.24.167.199:8080;        # proxy_set_header Host $host;                # proxy_set_header X-Forward-For $remote_addr;       # proxy_set_header X-Real-IP $remote_addr;               if ($host ~* testwap.skg.com) {            rewrite ^/(.*)$ http://lifetestwap.skg.com/$1 permanent;                                }                }   location  /scripts/bbswx/ {         #root   html;         #index  index.html index.htm index.jsp;         #client_max_body_size    100m;         #proxy_pass   http://10.24.167.199:8080;         #proxy_set_header Host $host;                 #proxy_set_header X-Forward-For $remote_addr;        #proxy_set_header X-Real-IP $remote_addr;                 if ($host ~* testwap.skg.com) {            rewrite ^/(.*)$ http://lifetestwap.skg.com/$1 permanent;                                }                }    location /shopfront/ec/pay/ {        index  index.html index.htm index.jsp;        proxy_pass   http://10.24.167.199:8089;        proxy_set_header Host $host;        proxy_set_header X-Forward-For $remote_addr;        proxy_set_header X-Real-IP $remote_addr;        add_header From testwap.skg.com;        proxy_cookie_path /shopfront/ec/pay/  /;        proxy_set_header Cookie $http_cookie;                                }  location  / {        #root   html;        index  index.html index.htm index.jsp;        client_max_body_size    100m;        proxy_pass   http://10.24.167.199:8088;        proxy_set_header Host $host;        proxy_set_header X-Forward-For $remote_addr;       proxy_set_header X-Real-IP $remote_addr;                }      }server {    #listen       8000;    listen       80;    server_name  testapi.skg.com;access_log logs/testapi.skg.com.access.log main;    location / {        #root   html;        #index  index.html index.htm;        proxy_pass   http://10.24.167.199:8086;        proxy_set_header Host $host;        proxy_set_header X-Forward-For $remote_addr;        proxy_set_header X-Real-IP $remote_addr;        client_max_body_size    1000m;    }}    server {    listen       80;    server_name testadmin.skg.com;    #charset koi8-r;    #access_log  logs/host.access.log  main;    location / {        #root   html;        index  index.html index.htm index.jsp;        #client_max_body_size    100m;        proxy_pass   http://10.24.167.199:8087;        proxy_set_header Host $host;        proxy_set_header X-Forward-For $remote_addr;       proxy_set_header X-Real-IP $remote_addr;                }      }   server {    listen       443;    server_name testadmin.skg.com;    #charset koi8-r;    #access_log  logs/host.access.log  main;        ssl on;    ssl_certificate /usr/local/key/server.cer;    ssl_certificate_key /usr/local/key/server2.key;    ssl_session_timeout 5m;    #access_log /var/log/nginx/access.log;    #error_log /var/log/nginx/error.log;    ssl_protocols SSLv2 SSLv3 TLSv1;    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLV2:+EXP;    ssl_prefer_server_ciphers on;     location / {        #root   html;        index  index.html index.htm index.jsp;        #client_max_body_size    100m;        proxy_pass   http://10.24.167.199:8087;        proxy_set_header Host $host;        proxy_set_header X-Forward-For $remote_addr;        proxy_set_header X-Real-IP $remote_addr;                }      }   server { listen         80; server_name testd.skg.com; location = /generateImage.html {      proxy_pass http://testd.skg.com/generateImage.html;     }		   location /storefront/member/toLogin.html {      rewrite . https://testlogin.skg.com/storefront/member/toLogin.html;    } location /storefront/member/checkLogin.html{  proxy_pass http://testd.skg.com/storefront/member/checkLogin.html;	} location /storefront/member/cookieLogin.html{      proxy_pass http://testd.skg.com/storefront/member/checkLogin.html;	} location /wap.html{  proxy_pass http://testd.skg.com/wap.html;	} location /storefront/member/checkCertificateView.html{  rewrite .  https://testlogin.skg.com/storefront/member/checkCertificateView.html;	} location / {    proxy_set_header Host $host;    proxy_set_header X-Forward-For $remote_addr;    proxy_set_header X-Real-IP $remote_addr;    proxy_pass   http://testd.skg.com;             } } server {    listen       443;    server_name testlogin.skg.com;     ssl on;    ssl_certificate /usr/local/key/server.cer;    ssl_certificate_key /usr/local/key/server2.key;    ssl_session_timeout 5m;    #access_log /var/log/nginx/access.log;    #error_log /var/log/nginx/error.log;    ssl_protocols SSLv2 SSLv3 TLSv1;    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLV2:+EXP;    ssl_prefer_server_ciphers on;     #charset koi8-r;location /storefront/member/toLogin.html{	proxy_pass http://testd.skg.com/storefront/member/toLogin.html;	}		location /storefront/member/getValidCode.html{	proxy_pass http://testd.skg.com/storefront/member/getValidCode.html;	}location /storefront/member/login.html{	proxy_pass http://testd.skg.com/storefront/member/login.html;	}location /storefront/member/checkLogin.html{	proxy_pass http://testd.skg.com/storefront/member/checkLogin.html;	}location /storefront/member/cookieLogin.html{	proxy_pass http://testd.skg.com/storefront/member/cookieLogin.html;	}location /storefront/member/checkCertificateView.html{	proxy_pass http://testd.skg.com/storefront/member/checkCertificateView.html;	}location /storefront/member/registerByEmail.html{	proxy_pass http://testd.skg.com/storefront/member/registerByEmail.html;	}location /storefront/member/registerByMobile.html{	proxy_pass http://testd.skg.com/storefront/member/registerByMobile.html;	}		location /storefront/member/logout.html{	proxy_pass http://testd.skg.com/storefront/member/logout.html;	}location /generateImage.html{	proxy_pass http://testd.skg.com/generateImage.html;	}   location ~* \.(css|js)$    {      root /usr/local/nginx/html/;      access_log off;    }

}

server {    listen       443;    server_name testskg.skg.com; 	ssl on;    ssl_certificate /usr/local/key/server.cer;    ssl_certificate_key /usr/local/key/server2.key;    ssl_session_timeout 5m;    #access_log /var/log/nginx/access.log;    #error_log /var/log/nginx/error.log;    ssl_protocols SSLv2 SSLv3 TLSv1;    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLV2:+EXP;    ssl_prefer_server_ciphers on; 	    #charset koi8-r;    if ( $request_uri ~* ^/index\.htm$ )       {        rewrite  ^/index\.htm$   http://testskg.skg.com permanent;		}       #location = / {#      root /usr/local/nginx/html; #      index  index.htm index.html;#      access_log off; #     }    location ^~ /scripts/       {      root /usr/local/nginx/html/scripts;      access_log off;          }    location ^~ /styles/        {      root /usr/local/nginx/html/styles;      access_log off;        }       }    server {    listen       80;    server_name  testo.skg.com;    location / {         index  index.html index.htm index.jsp;         proxy_pass http://testo.skg.com;         proxy_set_header Host $host;         proxy_set_header X-Forward-For $remote_addr;         proxy_set_header X-Real-IP $remote_addr;                }             }

}

`

转载于:https://my.oschina.net/u/2419285/blog/844848

你可能感兴趣的文章
基础知识 - Golang 中的正则表达式
查看>>
分享一个shell脚本的坑:grep匹配+wc取值 在脚本执行后的结果与手动执行结果不一致...
查看>>
【Clojure 基本知识】 关于函数参数的各种高级用法
查看>>
Python系列文章
查看>>
顺序图【6】--☆☆
查看>>
5日均线MACD
查看>>
Docker 版本
查看>>
【ABP杂烩】面向切面编程(AOP)知识总结
查看>>
java 如何使用多线程调用类的静态方法?
查看>>
数据挖掘基本概念讲解
查看>>
(原創) C语言果然是不会死的语言 (C/C++) (C) (IC Design) (DE2) (Nios II)
查看>>
不能运行VS2005的DSL Tool例子
查看>>
OSI/RM参考模型和TCP/IP协议的关系
查看>>
Android Intent用法汇总
查看>>
Vista上运行VisualStudio2005,调试asp.net程序的怪问题
查看>>
理解HTTP幂等性
查看>>
登录服务器,首先用到的5个命令
查看>>
使用PIP扩展BTARN
查看>>
GetLastError()返回值及含义
查看>>
android UI之Shape详解_GradientDrawable
查看>>