读书人

nginx配置示范

发布时间: 2013-09-09 20:31:09 作者: rapoo

nginx配置示例

#user  nobody;worker_processes  8;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {    worker_connections  51200;}http {    include       mime.types;    default_type  application/octet-stream;    include    gzip.conf;     #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  65;    upstream ad.test.cn {server 127.0.0.1:8080;}    upstream ad78.test.cn {        server 192.168.250.78:8080;        }    upstream adpic.test.cn {        server 192.168.250.78:80;        }    server {        listen       80;        server_name  ad.test.cn;access_log/var/log/nginx/ad.test.cn-access.log;error_log/var/log/nginx/ad.test.cn-error.log;        location / {            index  index.html index.htm index.jsp;    proxy_pass http://ad.test.cn;include proxy.conf;        }        location /admin {            index  index.html index.htm index.jsp;            proxy_pass http://adpic.test.cn;        include proxy.conf;        }        location /manager {            index  index.html index.htm index.jsp;            proxy_pass http://ad78.test.cn;        include proxy.conf;        }location /admin/promotion/ {            index  index.html index.htm index.jsp;root /data/deploy/promotion/promotion-admin;include proxy.conf;        }        location /admin/posphoto/ {            index  index.html index.htm index.jsp;root /data/deploy/promotion/promotion-admin;include proxy.conf;        }        location /promotion {        root /data/cdn;        index  index.html index.htm;        }        location /admin/img/ {            index  index.html index.htm index.jsp;    alias /data/cdn/promotion/img/;include proxy.conf;        }       error_page 403 = http://test.cn/error/FileNotFound;       error_page 404 = http://test.cn/error/FileNotFound;        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }# location /admin {#            index  index.html index.htm index.jsp;#            proxy_pass http://ad.test.cn;#include proxy.conf;#        }#        location /manager {#            index  index.html index.htm index.jsp;#            proxy_pass http://ad.test.cn;#include proxy.conf;#        }        location ~ ^/(WEB-INF)/ {            deny all;        }        location ~ .\.(jsp|action|fetion)?$ {            proxy_pass http://ad.test.cn;include proxy.conf;        }    }}

读书人网 >开源软件

热点推荐