NGINX-配置例子04

#user  nobody;
worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        location /jcy {
            root /var/www;
        try_files $uri $uri/ /jcy/index.html;
            index  index.html index.htm;
        }

    location ~* /boss {
            root  /home/www;
            index  dist/index.html;
            try_files  $uri $uri/ /boss/dist/index.html;
        }

    location / {
            root   /data/upload;
            index  index.html index.htm;
        }

    error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
 include vhost/*.conf;
}
server {
  listen       80;
  server_name api.jc;
  #charset koi8-r;
  proxy_connect_timeout 30s;
  proxy_send_timeout 120;
  proxy_read_timeout 120;
  proxy_buffer_size 32k;
  proxy_buffers 4 32k;
  proxy_busy_buffers_size 64k;
  proxy_redirect off;
  proxy_hide_header Vary;
  proxy_set_header Accept-Encoding '';
  proxy_set_header Host $host;
  proxy_set_header Referer $http_referer;
  proxy_set_header Cookie $http_cookie;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  access_log /usr/local/nginx/logs/api.jc.log;
  location / {
  proxy_pass http://10.0.31.140:8080;
             }
}
server {
        listen       80;
        server_name doc.jc;
        #charset koi8-r;
        proxy_connect_timeout 30s;
        proxy_send_timeout 120;
        proxy_read_timeout 120;
        proxy_buffer_size 32k;
        proxy_buffers 4 32k;
        proxy_busy_buffers_size 64k;
        proxy_redirect off;
        proxy_hide_header Vary;
        proxy_set_header Accept-Encoding '';
        proxy_set_header Host $host;
        proxy_set_header Referer $http_referer;
        proxy_set_header Cookie $http_cookie;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        access_log /usr/local/nginx/logs/doc.jc.log;
        location / {
            try_files $uri @confluence;
        }
        location @confluence {
            internal;
            proxy_pass http://127.0.0.1:8090;
        }
}
server {
        listen 80;
        server_name xczapi.jc;
        location ~* /mobile {
            root /data/xczapi.jc/wwww;
            index index.html index.htm;
            try_files $uri $uri/ /mobile/index.html;
        }

        location / {
            root /data/xczapi.jc/wwww/www;
            index index.html index.htm;
            try_files $uri $uri/ /index.html;
            if ( $http_user_agent ~ "iPhone|Android" ) {
                 rewrite ^(.*) http://10.0.31.119/mobile/ permanent;
            }
        }
}

你可能感兴趣的:(NGINX-配置例子04)