nginx配置代理文件、反向代理配置


nginx配置代理文件、反向代理配置

 

server {
    listen 80;
    listen 443 ssl;
    # 域名
    server_name asgcode.test.com; 
    ssl on;
    ssl_certificate   /home/test/aiphoto_data_maintain/run/ssl/server.crt;
    ssl_certificate_key  /home/test/aiphoto_data_maintain/run/ssl/server.key;
    ssl_client_certificate /home/test/aiphoto_data_maintain/run/ssl/root.crt;
    ssl_verify_client on;
    ssl_session_timeout 5m;
    client_max_body_size 20m;
    # https
    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    access_log /data/asgcode/logs/nginx/access.log main;
    error_log  /data/asgcode/logs/nginx/error.log;

#location /myfiles/ {
#     alias /home/test/test_file/;
#     autoindex on;               # 自動列出目錄下的文件;
#     autoindex_exact_size off;   # 文件大小按 G、M 的格式顯示,而不是 Bytes;
#     add_header Access-Control-Allow-Origin *;
#     add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
#     add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
#}

#代理文件
location /static/save_image/ {  
        alias /home/zhaoyingjie/aiphoto_data_maintain/static/save_image/;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
        add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
}

# 顯示文件
location /testdetect/ { 
        alias /home/zhaoyingjie/aiphoto_data_maintain/static/detect/;
        index index.html;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
        add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
}

# 反向代理
location / { 

    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods "POST,GET,OPTIONS";
    #add_header Access-Control-Allow-Headers x-requseted-with,content-type;
    add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_headers_hash_max_size 51200;
    proxy_headers_hash_bucket_size 6400;
    set_real_ip_from 0.0.0.0/0;
    real_ip_header  X-Forwarded-For;
    include  uwsgi_params;
    uwsgi_pass 127.0.0.1:7060;
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM