一、修改nginx 配置文件
server { listen 888; server_name www.域名.com; index index.html index.htm index.php; root /www/wwwroot/文件根目录; #error_page 404 = /404.html; #error_page 502 = /502.html; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; try_files $fastcgi_script_name =404; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } location ~ /\.ht { deny all; } }
二、伪静态
location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } }