nginx下实现对Thinkphp的支持

浏览:928 发布日期:2014/09/13 分类:技术分享
网上找来的,亲测可以使用
location / {
# try to serve file directly, fallback to front controller
try_files $uri /index.php$is_args$args;
}

# If you have 2 front controllers for dev|prod use the following line instead
# location ~ ^/(index|index_dev)\.php(/|$) {
location ~ ^/index\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param script_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;

# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/index.php/some-path
# Enable the internal directive to disable URIs like this
# internal;
}

#return 404 for all php files as we do have a front controller
location ~ \.php$ {
return 404;
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>