server{
listen 80;
server_name www.herb.com herb.com;
access_log /data/www/logs/www.localhost-access_log main;
error_log /data/www/logs/www.localhost-error_log warn;
root /data/www/html/code/yuesaoapp;
index index.php index.html;
#thinkphp框架重写设置
location / {
try_files $uri $uri/ /index.php?$query_string;
index index.php;
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|map|svg|ttf|woff|ico)$
{
expires 1d;
access_log off;
}
location ~ .*\.php$ {
include fastcgi_params;
fastcgi_pass unix:/dev/shm/php-fcgi.sock;
}
#location ~ \.php$ {
# root /data/www/html/code/yuesaoapp;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
# }
}
转载请注明:梦绘设计 » WEB运维 » nginx设置thinkphp重写规则
版权声明
本站《作品展示》类文章均为原创,转载必须注明出处,技术分享类文章部分来源于网络,版权归原作者所有,若侵权请留言。
继续浏览有关 thinkphpnginx.rewrite 的文章