zoukankan      html  css  js  c++  java
  • nginx配置-http和https

    #user nobody;
    worker_processes 1;
    error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;
    worker_rlimit_nofile 204800;

    events {
    worker_connections 204800;
    multi_accept on;
    use epoll;
    }


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

    log_format test166 '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for" '
    '"[$request_time]" "[$upstream_response_time]" '
    '"[$connection]" "[$connection_requests]" '
    '"$http_imei" "$http_mobile" "$http_type" "$http_key" "$cookie_sfpay_jsessionid"';
    access_log logs/access.log test166;

    sendfile on;
    #tcp_nopush on;
    underscores_in_headers on;

    keepalive_timeout 65;
    proxy_connect_timeout 10s;
    proxy_read_timeout 120;
    proxy_send_timeout 60;
    proxy_buffer_size 16k;
    proxy_buffers 4 64k;
    proxy_busy_buffers_size 128k;
    proxy_temp_file_write_size 128k;
    proxy_temp_path /home/temp_dir;
    proxy_cache_path /home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;

    client_header_buffer_size 12k;
    open_file_cache max=204800 inactive=65s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 1;

    fastcgi_intercept_errors on;


    gzip on;
    gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/jpg;

    upstream ims-oms {
    server 10.118.240.31:8001;
    }

    upstream up_cms {
    server 10.118.242.206:8080;
    # server 10.118.244.163:8080;
    }
    upstream up_adms {
    server 10.118.242.206:8082;
    #server 10.118.200.19:8080;
    }
    upstream up_psfm {
    server 10.118.242.206:8081;

    }
    # HTTP server
    #
    server {
    listen 8080;
    server_name 10.118.213.96;

    location /nginx_status {
    stub_status on;
    access_log off;
    }
    location /cms {
    proxy_pass http://10.118.244.163:8080/cms;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host:8080;
    index login.jsp;
    #proxy_redirect default;
    proxy_cache off;
    }

    location /Adms {
    proxy_pass http://up_adms/Adms;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    #proxy_redirect https://10.118.213.96:8443/Adms /adms;
    proxy_cache off;
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
    }


    # redirect server error pages to the static page /50x.html
    #
    error_page 400 403 404 500 502 503 504 /40x.html;
    location = /40x.html {
    #proxy_pass https://127.0.0.1:8080/notice.png;
    root html;
    }
    # redirect server error pages to the static page /40x.html
    #

    location ~*.(gif|jpg|jpeg|ico|gif|png|bmp|js|css)$ {
    root images;
    }


    location = /favicon.ico {
    log_not_found off;
    access_log off;
    }
    }

    #HTTPS SERVER
    #
    server {
    listen 8443;
    server_name 10.118.213.96;

    ssl on;
    ssl_certificate server.key;
    ssl_certificate_key server.pem;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers
    AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
    ssl_prefer_server_ciphers on;

    rewrite '/(login)/(.*)' /cms/$1/$2;
    #rewrite '/Adms/(.js|css)' https://xbox.sf-pay.com/Adms/$1;
    location /cms {
    proxy_pass http://up_cms/cms;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    }

    location /psfm{
    proxy_pass http://up_psfm/psfm;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    }

    location / {
    proxy_pass http://up_cms/cms/login.jsp;
    rewrite '/(.*)/(.*)' /cms/$1/$2;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    }


    location /AutoDeploy {
    proxy_pass http://up_cms/AutoDeploy;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    }


    #location /Bugzilla {
    #proxy_pass http://up_cms/Bugzilla;
    # proxy_set_header Host $host;
    # proxy_set_header X-Real-IP $remote_addr;
    # proxy_set_header X-Forwarded-Proto https;
    #}

    location /Adms {
    proxy_pass http://up_adms/Adms;
    #proxy_pass http://10.118.242.206:8082/Adms/;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    #proxy_redirect https://10.118.213.96:8443/Adms /adms;
    proxy_cache off;
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
    }

    error_page 400 403 404 500 502 503 504 /40x.html;
    location = /40x.html {
    #proxy_pass https://127.0.0.1:8443/notice.png;
    root html;
    }

    location ~*.(gif|jpg|jpeg|ico|gif|png|bmp)$ {
    root images;
    }


    location = /favicon.ico {
    log_not_found off;
    access_log off;
    }
    }
    }

    ----------------------------------------------

    #user nobody;
    worker_processes 1;
    error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;

    #pid logs/nginx.pid;
    worker_rlimit_nofile 204800;

    events {
    worker_connections 204800;
    multi_accept on;
    use epoll;
    }


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

    log_format test166 '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for" '
    '"[$request_time]" "[$upstream_response_time]" '
    '"[$connection]" "[$connection_requests]" '
    '"$http_imei" "$http_mobile" "$http_type" "$http_key" "$cookie_sfpay_jsessionid"';
    access_log logs/access.log test166;

    sendfile on;
    #tcp_nopush on;
    underscores_in_headers on;

    keepalive_timeout 65;
    proxy_connect_timeout 10s;
    proxy_read_timeout 120;
    proxy_send_timeout 60;
    proxy_buffer_size 16k;
    proxy_buffers 4 64k;
    proxy_busy_buffers_size 128k;
    proxy_temp_file_write_size 128k;
    proxy_temp_path /home/temp_dir;
    proxy_cache_path /home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;

    client_header_buffer_size 12k;
    open_file_cache max=204800 inactive=65s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 1;

    fastcgi_intercept_errors on;


    gzip on;
    gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png image/jpg;

    upstream ims-oms {
    server 10.118.240.31:8001;
    }

    upstream up_cms {
    server 10.118.242.206:8080;
    # server 10.118.244.163:8080;
    }
    upstream up_adms {
    server 10.118.242.206:8082;
    #server 10.118.200.19:8080;
    }
    upstream up_psfm {
    server 10.118.242.206:8081;

    }
    upstream up_syAssistant {
    server 10.118.242.206:8088;

    }
    # HTTP server
    #
    server {
    listen 8080;
    server_name 10.118.213.96;

    location /nginx_status {
    stub_status on;
    access_log off;
    }
    location /cms {
    proxy_pass http://up_cms/cms;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    index login.jsp;
    #proxy_redirect default;
    proxy_cache off;
    }
    location /psfm {
    proxy_pass http://up_psfm/psfm;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    proxy_cache off;
    }
    location /syAssistant {
    proxy_pass http://up_syAssistant/syAssistant;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    proxy_cache off;
    }
    # redirect server error pages to the static page /50x.html
    #
    error_page 400 403 404 500 502 503 504 /40x.html;
    location = /40x.html {
    #proxy_pass https://127.0.0.1:8080/notice.png;
    root html;
    }
    # redirect server error pages to the static page /40x.html
    #

    location ~*.(gif|jpg|jpeg|ico|gif|png|bmp|js|css)$ {
    root images;
    }


    location = /favicon.ico {
    log_not_found off;
    access_log off;
    }
    }

    #HTTPS SERVER
    #
    server {
    listen 8443;
    server_name 10.118.213.96;

    ssl on;
    ssl_certificate server.key;
    ssl_certificate_key server.pem;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers
    AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
    ssl_prefer_server_ciphers on;

    #rewrite '/(login)/(.*)' /cms/$1/$2;
    #rewrite '/Adms/(.js|css)' https://xbox.sf-pay.com/Adms/$1;
    location /cms {
    proxy_pass http://up_cms/cms;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    }

    location /psfm {
    proxy_pass http://up_psfm/psfm;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    server_name_in_redirect on;
    }

    # location / {
    # proxy_pass http://up_cms/cms/login.jsp;
    # rewrite '/(.*)/(.*)' /cms/$1/$2;
    # proxy_set_header Host $host;
    # proxy_set_header X-Real-IP $remote_addr;
    # proxy_set_header X-Forwarded-Proto https;
    # }


    # location /AutoDeploy {
    # proxy_pass http://up_cms/AutoDeploy;
    #proxy_pass http://10.118.244.163:8080/cms/;
    #proxy_redirect default;
    # proxy_set_header Host $host;
    # proxy_set_header X-Real-IP $remote_addr;
    # proxy_set_header X-Forwarded-Proto https;
    # server_name_in_redirect on;
    # }


    #location /Bugzilla {
    #proxy_pass http://up_cms/Bugzilla;
    # proxy_set_header Host $host;
    # proxy_set_header X-Real-IP $remote_addr;
    # proxy_set_header X-Forwarded-Proto https;
    #}

    # location /Adms {
    # proxy_pass http://up_adms/Adms;
    # #proxy_pass http://10.118.242.206:8082/Adms/;
    # proxy_set_header X-Real-IP $remote_addr;
    # proxy_set_header Host $host;
    # #proxy_redirect https://10.118.213.96:8443/Adms /adms;
    # proxy_cache off;
    # add_header 'Access-Control-Allow-Origin' '*';
    # add_header 'Access-Control-Allow-Credentials' 'true';
    # add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
    # }

    error_page 400 403 404 500 502 503 504 /40x.html;
    location = /40x.html {
    #proxy_pass https://127.0.0.1:8443/notice.png;
    root html;
    }

    location ~*.(gif|jpg|jpeg|ico|gif|png|bmp)$ {
    root images;
    }


    location = /favicon.ico {
    log_not_found off;
    access_log off;
    }
    }
    }

     ----------------------------带nginx目录访问的配置

    [tomcat@app01 conf]$ more nginx.conf

    #user nobody;
    worker_processes 1;

    #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 {
    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;
    keepalive_timeout 65;

    #gzip on;

    server {
    listen 8443;
    server_name localhost;
    #root /home/nginx/nginx-home/android/sit;
    root /home/nginx/nginx-home/download/;
    autoindex on;
    autoindex_exact_size on;
    autoindex_localtime on;

    location ~ ^/NginxStatus/ {
    stub_status on;
    access_log off;
    }

    }

    server {
    listen 8088;
    server_name localhost;

    #charset koi8-r;
    charset utf-8;
    access_log logs/host.access.log main;
    autoindex on;
    autoindex_exact_size on;
    autoindex_localtime on;

    location ~ ^/NginxStatus/ {
    stub_status on;
    access_log off;
    }

    location / {
    #root html;
    root /home/nginx/nginx-home/download;
    index index.html index.htm;
    }

    #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 localhost;

    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;

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

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

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

    }

  • 相关阅读:
    tableau用户留存分析
    tableau用户分类
    业务
    数据分析的思维技巧-二
    数据分析的思维技巧
    业务化思维
    公式化思维
    结构化思维
    Shortest Unsorted Continuous Subarray
    Longest Harmonious Subsequence
  • 原文地址:https://www.cnblogs.com/anruy/p/5151184.html
Copyright © 2011-2022 走看看