Rock笔记
~/rocknotes/articles/302.md article
// article · laravel

在 Nginx 里把 Laravel 配置到域名的二级目录里

需求

现有域名www.test.com,这个域名已有使用在其他系统,现在需要把一个Laravel项目挂到www.test.com/newproject/下,通过访问http://www.test.com/newproject/可以访问到Laravle项目的首页



Nginx配置

在站点配置.conf文件下添加如下代码即可

location /newproject/ {  
    index  index.php index.phpindex.html index.htm;  
    if (!-e $request_filename){  
        rewrite  ^/newproject/(.*)$  /newproject/index.php?s=$1  last;  
    }
}

image.png


回复// 0 replies

最新回复 ↓
// 暂无回复

回复功能沿用原详情页:前往原页面参与讨论 →