操作系统:ubuntu13.10服务器:nginx1.6在nginx配置根据url指向不同访问不同的目录使用location/目录名{...}可以做到不同的目录访问但是我想搭建laravel4framework,想通过/coolwifi/test就直接解析成/coolwifi/public/index.php/test,但是会报错:Symfony\Component\HttpKernel\Exception\NotFoundHttpException但是通过http://localhost/coolwifi/public/index.php/test访问是可以的我该怎么做?default配置文件如下:server{listen80default_server;listen[::]:80default_serveripv6only=on;root/home/kimhwawoon/nginx;indexindex.phpindex.htmlindex.htm;#Makesiteaccessiblefromhttp://localhost/server_namelocalhost;location/coolwifi/{indexindex.php;#if(!-e$request_filename){#rewrite^/(.*)$/public/index.php?$1last;#break;#}try_files$uri$uri//coolwifi/public/index.php?$args;}location/phpmyadmin/{indexindex.phptry_files$uri$uri//phpmyadmin/index.php?$args;}location/swagger/{indexindex.htmlindex.php;}location/doc/{alias/usr/share/doc/;autoindexon;allow127.0.0.1;allow::1;denyall;}location~\.php${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;}}
2 回答
幕布斯6054654
TA贡献1876条经验 获得超7个赞
按照单个server怎么弄都不行,最后设置了多个server可以解决问题,并且在本机的/etc/hosts配置了多个域名指向本地,使用不同的域名区分不同的目录
添加回答
举报
0/150
提交
取消