URL Rewrite在Nginx中不起作用

Par*_*Das 3 .htaccess nginx ubuntu-12.04

URL重写在Nginx中不起作用,操作系统是Ubuntu 12.4 Lts

当打开http://mvc.loc它正在工作,但当我尝试打开http://mvc.loc/login不工作

404未找到

nginx的/ 1.1.19

.htaccess

<IfModule !mod_rewrite.c>
    ErrorDocument 500 "mod_rewrite must be enabled"
</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?u=$1
Run Code Online (Sandbox Code Playgroud)

mvc.loc的虚拟主机

server {
    listen 80;
    server_name mvc.loc;
    access_log /var/log/nginx/mvc.loc.access.log;
    error_log /var/log/nginx/mvc.loc.error.log;
    root /usr/share/nginx/www/mvc;

    index       index.php;


    # use fastcgi for all php files
    # Are you sure you have this set up?
    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;
    }

    # deny access to apache .htaccess files
    location ~ /\.ht {
     deny all;
    }

}
Run Code Online (Sandbox Code Playgroud)

Nan*_*mar 8

location / {    
   rewrite ^(.*)$ /index.php?u=$1 last;
}
Run Code Online (Sandbox Code Playgroud)