server {
    listen 8081;
    server_name _;
    root /workspace/wwwroot/zhct_sanquan/project/public;
    index index.php index.html;

    location = /aizhct {
        return 301 /aizhct/;
    }

    location ^~ /aizhct/ {
        rewrite ^/aizhct/(.*)$ /$1 break;
        proxy_pass http://127.0.0.1:18081;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location ^~ /uploads/ {
        root /workspace/wwwroot/aizhct_sanquan/project/public;
        try_files $uri =404;
    }

    location ^~ /downloads/ {
        root /workspace/wwwroot/aizhct_sanquan/project/public;
        try_files $uri =404;
    }

    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
        }
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_pass unix:/run/php-fpm73/php-fpm.sock;
    }

    location ~ /\. {
        deny all;
    }
}

server {
    listen 127.0.0.1:18081;
    server_name 127.0.0.1;
    root /workspace/wwwroot/aizhct_sanquan/project/public;
    index index.php index.html;

    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
        }
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_pass unix:/run/php-fpm74/php-fpm.sock;
    }

    location ~ /\. {
        deny all;
    }
}
