Url的重写
nginx的配置文件
[root@localhost protected]# vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ /(protected|framework|nbproject|themes/\w+/views|index-test\.php) {
deny all;
# for production
internal;
log_not_found off;
access_log off;
}
#error_page 404 /404.htm