ToroPHP nginx php5-fpm配置

配置nginx php5-fpm(更改domain.com)</ p>

  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;
}
位置〜\ .php {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
包括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;
}
}
</ code> </ pre>

此代码不能使用根路径... </ p>

示例:</ p> \ n

domain.com/parse/a/b - &gt; works
domain.com/parse - &gt; 作品</ p>

domain.com - &gt; 不工作</ p>
</ div>

展开原文

原文

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个回答



以下内容可帮助您解决问题:</ p>

更改 try_files $ uri @ 重写</ code>到 try_files $ uri $ uri / @rewrite </ code> </ p>

更改重写^ /(。*)$ /index.php/$1 ; </ code>到重写^ /(。*)$ /index.php?/$1 last; </ code>以防止无限重写循环。</ p>

如果这样 不解决它,让我知道,我会进一步调查。</ p>
</ div>

展开原文

原文

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.

doubiaode0460
doubiaode0460 你能帮我解决这个问题吗?
7 年多之前 回复
dqeonr8554
dqeonr8554 您的更改无法解析根URL ...示例仅访问domain.com(没有任何路径)
7 年多之前 回复
dongxun6458
dongxun6458 旁注:你的最后一个位置块可能与nginx无关,因为nginx不读取htaccess。
7 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐