怎么在 localhost 下访问多个 Laravel 项目?
比如 像这样
localhost/laravel1/public
localhost/laravel2/public
我在nginx 的是这样配置的
server {
listen 80;
server_name localhost;
location /laravel2/public {
try_files $uri $uri/ /index.php?$query_string;
index index.html index.htm index.php;
}
location /laravel1/public {
try_files $uri $uri/ /index.php?$query_string;
index index.html index.htm index.php;
}
sendfile off;
client_max_body_size 100m;
include fastcgi.conf;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
但这样似乎不工作,考虑在laravel 的route中放置一个前置事件,对 url解析成laravel可以识别的形式,只是有这个想法,不知道可行不可行,如有遇到相似问题,请不吝赐教,在此多谢了。
这个问题可以转换成,如何在一个域名下配置多个laravel项目
推荐文章: