Nginx

来源:互联网 发布:java中封装面试题 编辑:程序博客网 时间:2024/06/08 07:47
worker_rlimit_nofile 204800;
user  mateinfo inoc;
worker_processes  1;


error_log  /opt/mateinfo/logs/nginx/error.log;
#error_log  /opt/mateinfo/logs/nginx/error.log  notice;
#error_log  /opt/mateinfo/logs/nginx/error.log  info;


#pid        /opt/mateinfo/logs/nginx/nginx.pid;


events {
    worker_connections  1024;
}




http {
    include       mime.types;
    default_type  application/octet-stream;


    log_format  main  '$remote_addr - $remote_user [$time_iso8601] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"'
'"$upstream_addr" "$upstream_status" $upstream_response_time $request_time';


    access_log  /opt/mateinfo/logs/nginx/access.log  main;


    sendfile        on;
    keepalive_timeout  65;


# 连接超时
proxy_send_timeout 120;
    proxy_read_timeout 120;
    proxy_next_upstream off;
# 调度websocket配置
map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    } 


# 文本压缩
    gzip on;
gzip_min_length 2k;
gzip_buffers 16 64k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/xml text/javascript text/css text/plain application/xhtml+xml application/json text/json application/x-javascript application/javascript text/xhtml;
gzip_vary on;


# 上传文件大小限制
client_max_body_size 20m;
client_body_buffer_size 128k;


# 静态资源缓存配置
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_temp_path temp_dir/;
proxy_cache_path http_cache/ levels=1:2 keys_zone=Z:10m inactive=10m max_size=10g;
      server {
        listen       8080;
server_name owsgo.com;

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


location /nginx_status {
stub_status on;
}
    }
    server {
        listen       80;
        server_name  owsgo.com;


        charset utf-8;


# 设置客户端真实IP
proxy_set_header  X-real-ip $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;


# 静态资源缓存配置
proxy_cache Z;
proxy_cache_valid 200 10m;


# http反向代理配置--开始
location / {
            root   html;
            index  index.html index.htm;
        }


location /cas {
             proxy_pass http://127.0.0.1:8080;
        }


location /servicecreator {
             proxy_pass http://127.0.0.1:8080;
        }


location /app {
             proxy_pass http://127.0.0.1:8080;
        }

location /scheduling {
             proxy_http_version 1.1;
             proxy_set_header Upgrade $http_upgrade;
             proxy_set_header Connection $connection_upgrade;
             proxy_pass http://127.0.0.1:8080;
        }


        location /GisServer {
             proxy_pass http://127.0.0.1:8080;
        }


location /quartz {
proxy_pass http://127.0.0.1:8080;
}


        location /slm {
             proxy_pass http://127.0.0.1:8080;
        }


        location /autodotting {
             proxy_pass http://127.0.0.1:8080;
        }
# http反向代理配置--结束


        #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
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;


    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}




    # HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  owsgo.com;


charset utf-8;


        ssl_certificate      server.crt;
        ssl_certificate_key  server.key;


        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;


        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;


# 设置客户端真实IP
proxy_set_header  X-real-ip $remote_addr;
                proxy_set_header  X-real-host $host;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;


# 静态资源缓存配置
set $proxy_cache_type off;
if ($document_uri ~ .*\.(js|js_action|css|css_action|gif|jpg|ico|png|swf|html|htm|exe|xls)$) {
set $proxy_cache_type Z;
}
                if ($document_uri ~ .*\.(js|js_action|css|css_action|gif|jpg|ico|png|swf|html|htm|exe|xls|svg)(.*)) {
               set $proxy_cache_type Z;
                }
proxy_cache $proxy_cache_type;
proxy_cache_valid 200 10m;


# https反向代理配置--开始


        resolver 172.10.0.2 valid=30s;
        set $platform "http://internal-beta-trust-platform-421631283.ap-southeast-1.elb.amazonaws.com:8080";
        set $sso "http://internal-beta-trust-sso-1306063355.ap-southeast-1.elb.amazonaws.com:8080";
        set $scheduling "http://internal-beta-trust-dispatch-302764383.ap-southeast-1.elb.amazonaws.com:8080";
        set $schedulingXhr "http://internal-beta-trust-dispatch-302764383.ap-southeast-1.elb.amazonaws.com:80";
        set $slm "http://internal-beta-trust-slm-1366014523.ap-southeast-1.elb.amazonaws.com:8080";
        set $unibi "http://internal-beta-trust-unibi-1806211163.ap-southeast-1.elb.amazonaws.com:8080";
        set $sdm "http://internal-beta-trust-sdm-436907261.ap-southeast-1.elb.amazonaws.com:8080";
        set $improxy "http://internal-beta-DMZ-proxy-internal-1594816003.ap-southeast-1.elb.amazonaws.com:8080";
       
        location / {
            root   html;
            index  index.html index.htm;
        }

location /app {
proxy_pass $platform;
proxy_redirect $platform/ /;
}
location /servicecreator {
proxy_pass $platform;
proxy_redirect $platform/ /;
 
}

location /cas {
proxy_pass $sso;
proxy_redirect $sso/ /; 
}

                location /unibi {
proxy_pass $unibi;
proxy_redirect $unibi/ /; 
        }

location /pentaho-style {
            proxy_pass $unibi;
proxy_redirect $unibi/ /; 
        }


location /scheduling {
proxy_pass $scheduling;
proxy_redirect $scheduling/ /;
}  


               location ~ ^/scheduling/websocket/.*/websocket$ {
                         proxy_pass $scheduling; 
                         proxy_redirect $scheduling/ /;
                         proxy_http_version 1.1;
                         proxy_set_header Upgrade $http_upgrade;
                         proxy_set_header Connection $connection_upgrade;
                         proxy_set_header  X-real-ip $remote_addr;
                         proxy_set_header  X-real-host $host;
                         proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
               }
                
        location ~ ^/scheduling/websocket/.*/xhr {
             proxy_pass $schedulingXhr;
proxy_redirect $schedulingXhr/ /;
        }
 
location /GisServer {
proxy_pass $scheduling;
proxy_redirect $scheduling/ /;
}
location /slm {
            proxy_pass $slm;
proxy_redirect $slm/ /;
        }
location /bpmstudio {
            proxy_pass $sdm;
proxy_redirect $sdm/ /;
        }
location /bpmruntime {
            proxy_pass $sdm;
proxy_redirect $sdm/ /;
        }
location /quartz {
            proxy_pass $slm;
proxy_redirect $slm/ /;
        }
location /sms {
proxy_pass http://52.74.235.87:8080;
}


location /email {
proxy_pass http://52.74.235.87:8080;
}


location /autodotting {
   proxy_pass $slm;
proxy_redirect $slm/ /;
   }
location ~ ^/(qlikview|QvAjaxZfc|QvAJAXZfc|QVPrint){
rewrite ^(.*)$ /cas/sox/qlikviewproxy/$1 break;
proxy_set_header Accept-Encoding "";
proxy_pass $sso;
proxy_redirect $sso/ /; 
}


                location /improxy {            
                    proxy_pass $improxy;  
                    proxy_redirect $improxy/ /;      
                }
 
location /rb {
proxy_pass http://54.254.255.99:8088;
}
# https反向代理配置--结束

    }


       server {
        listen       8088;
        server_name  owsgo.com;
         
        resolver 172.10.0.2 valid=30s;
        set $platform "https://reli.owsgo.com";
        set $SOAP "http://b2b-test1.iewauh.com:6788";
        
        location / {
            root   html;
            index  index.html index.htm;
        }


        location /fm_pm_ws {
                        proxy_pass https://219.133.94.178:15399;
        }
location /SOAP{
                proxy_pass $SOAP;
proxy_redirect $SOAP/ /;
        }
location /servicecreator {
             proxy_pass $platform;
proxy_redirect $platform/ /;
         }


    }


}
0 0
原创粉丝点击