• 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;
        }
    }
  • 相关阅读:
    PCB设计实战项目指导班26层板的设计
    AT2171 [AGC007D] Shik and Game 题解
    UVA11327 Enumerating Rational Numbers 题解
    P6222 「P6156 简单题」加强版 题解
    CF702F TShirts 题解
    P3747 [六省联考 2017] 相逢是问候 题解
    『学习笔记』PollardRho 算法 题解
    P7453 [THUSCH2017] 大魔法师 题解
    CF1575L Longest Array Deconstruction 题解
    最大公约数之和
  • 原文地址:https://www.cnblogs.com/zhaoyingjie/p/15412735.html
Copyright © 2020-2023  润新知