2014-07-25 2 views
0

파일과 일치하지 않는 모든 요청을 /framework/root.php?path={whatever the request $uri was}에 전달하고 싶습니다.Nginx 루트 디렉토리를 제외하고 다시 쓰기

이것은 /을 제외한 모든 요청 (예 : http://localhost)에만 적합합니다.

PS :

여기 내 Nginx에의 설정입니다 만 Nginx에 오늘 아파치에서 나오는 사용하기 시작했습니다.

server { 

    listen 80; 

    root /var/www/html; 
    server_name localhost; 

    location/{ 
     try_files $uri $uri/ @root; 
    } 

    location @root { 
     rewrite ^(.*)$ /framework/root.php?path=$1; 
    } 

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    location ~ \.php$ { 
     try_files $uri =404; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
     fastcgi_index index.php; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     include fastcgi_params; 
    } 

    # deny access to .htaccess files, if Apache's document root 
    # concurs with nginx's one 
    # 
    location ~ /\.ht { 
     deny all; 
    } 
} 

답변

0

Oooo.

try_files $uri $uri/ @root;/ 디렉토리와 일치하므로 $uri/ 부분이없는 try_files $uri @root;이어야합니다.