ngxin開啓rewrite僞靜態

一、編輯nginx配置文件php

vi  /usr/local/nginx/conf/nginx.conf
#include enable-php.conf;
include enable-php-pathinfo.conf;

二、在server後面加上nginx

location / {
            if (!-e $request_filename) {
               rewrite ^/(.*)$ /index.php/$1 last;
               break;
            }
       }
location ~ /index.php {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    include    fastcgi_params;
    fastcgi_param APPLICATION_ENV dev;
}

三、保存後不要忘記重啓nginxbash

service nginx restart 或者 nginx -s reload
相關文章
相關標籤/搜索