laravel在nginx上配置子文件夹访问及gogs子文件夹反向代理访问

https://asked.io/host-laravel-in-a-sub-directory-with-nginx

 

    location ^~ /api {
        alias /home/wwwroot/default/api/public;
        try_files $uri $uri/ @api_rewrite;

        location ~* \.php {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include        fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /home/wwwroot/default/api/public/index.php;
        }
    }

    location @api_rewrite {
        rewrite ^/api/(.*)$ /api/index.php?$query_string;
    }


    location ^~ /gogs {
        rewrite ^/gogs(/.*)$ $1 break;
        proxy_pass  http://127.0.0.1:3000/;

    }

Leave a Reply

Your email address will not be published. Required fields are marked *