操作系統(tǒng):ubuntu13.10
服務(wù)器:nginx 1.6
在nginx配置根據(jù)url指向不同訪問不同的目錄
使用location /目錄名 { ... } 可以做到不同的目錄訪問
但是我想搭建laravel4 framework,想通過/coolwifi/test就直接解析成/coolwifi/public/index.php/test,但是會報(bào)錯:
Symfony Component HttpKernel Exception NotFoundHttpException
但是通過http://localhost/coolwifi/public/index.php/test訪問是可以的
我該怎么做?
default配置文件如下:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/kimhwawoon/nginx;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location /coolwifi/ {
index index.php;
#if (!-e $request_filename) {
# rewrite ^/(.*)$ /public/index.php? last;
# break;
#}
try_files $uri $uri/ /coolwifi/public/index.php?$args;
}
location /phpmyadmin/ {
index index.php
try_files $uri $uri/ /phpmyadmin/index.php?$args;
}
location /swagger/ {
index index.html index.php;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
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;
}
}
歡迎選擇我的課程,讓我們一起見證您的進(jìn)步~~
按照單個server怎么弄都不行,最后設(shè)置了多個server可以解決問題,并且在本機(jī)的/etc/hosts配置了多個域名指向本地,使用不同的域名區(qū)分不同的目錄
請問樓主使用過phalcon嗎?最近我學(xué)習(xí)了下phalcon,但是按你這樣設(shè)置所有的路由都重定向到了index/index了,請問你有解決方案嗎?謝謝