CakePHP nginx重写规则

凉白开 Nginx1 10,898字数 621阅读2分4秒阅读模式

CakePHP nginx重写规则如下

server {
 listen 80;
 server_name www.ttlsa.com;
root /data/site/www.ttlsa.com;
 index index.php;
access_log /data/logs/nginx/www.ttlsa.com_accerss.log;
 error_log /data/logs/nginx/www.ttlsa.com_error.log;
# main cakephp rewrite rule
 location / {
 try_files $uri $uri/ /index.php?$uri&$args;
 }
location ~ .php$ {
 root /data/site/www.ttlsa.com;
 try_files $uri =404;
 fastcgi_pass unix:/tmp/php5-fpm.sock; # 改成你对应的FastCGI
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 fastcgi_buffer_size 128k;
 fastcgi_buffers 256 4k;
 fastcgi_busy_buffers_size 256k;
 fastcgi_temp_file_write_size 256k;
 }
}

重启nginx即可文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-configuration-for-cakephp/ 文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-configuration-for-cakephp/

weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
凉白开
  • 本文由 发表于 02/08/2014 01:00:37
  • 转载请务必保留本文链接:https://www.ttlsa.com/nginx/nginx-configuration-for-cakephp/
评论  1  访客  1
    • Aceslup
      Aceslup 9

      重定向规则是相当的考虑周全呢。

    评论已关闭!