duaiwu8385 2013-05-30 19:19
浏览 62

ToroPHP nginx php5-fpm配置

Configurations nginx php5-fpm (change domain.com)

server {
  listen 80 default;
  server_name domain.com;

  root /var/www/domain.com;
  access_log /var/log/nginx/domain.com.access_log;
  error_log /var/log/nginx/domain.com.error_log;
   index index.php;

   try_files $uri @rewrite;

  location @rewrite {
    rewrite ^/(.*)$ /index.php/$1;
  }   
  location ~ \.php {
   fastcgi_index index.php;
   fastcgi_pass 127.0.0.1:9000;
   include fastcgi_params;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   fastcgi_param PATH_INFO $fastcgi_path_info;
   fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

  location ~ /\.ht {
    deny all;
  }
}

This code not working with the root path...

Examples:

domain.com/parse/a/b --> works domain.com/parse --> works

domain.com --> Not working

  • 写回答

1条回答 默认 最新

  • dpv50040 2013-05-30 19:24
    关注

    The following should help you fix the problem:

    Change try_files $uri @rewrite to try_files $uri $uri/ @rewrite

    Change rewrite ^/(.*)$ /index.php/$1; to rewrite ^/(.*)$ /index.php?/$1 last; to prevent an infinite rewrite loop.

    If this does not fix it, let me know and I'll look into it further.

    评论

报告相同问题?

悬赏问题

  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致