如何使用nginx别名在现有的php项目中配置laravel项目?

问题描述 投票:0回答:1

这是我现有的项目的nginx config文件。我可以访问sms.dev/index.php。现在,我想在/var/www/html/laravel文件夹上部署一个新的laravel项目,并使用像sms.dev/laravel这样的域来访问我的新laravel项目。这该怎么做 ?

server{
        listen 80;
        server_name sms.dev;
        index index.php index.html index.htm;
        root /var/www/html/sms;
        location /laravel/ {
            # how to config it ?
        }
        location ~ .*\.(php|php5)?$
        {
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fcgi.conf;
        }

        if (!-e $request_filename) {
                return 404;
        }
}
php laravel nginx
1个回答
0
投票

尝试在您的位置块中添加try_files $uri $uri/ /index.php?$query_string;

location /laravel/ {
    try_files $uri $uri/ /index.php?$query_string;
}
© www.soinside.com 2019 - 2024. All rights reserved.