• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

nginx环境thinkphp,500异常

php 搞代码 4年前 (2022-01-24) 29次浏览 已收录 0个评论

nginx环境thinkphp,500错误

本帖最后由 u012335455 于 2014-07-22 19:16:10 编辑

今天吧网站放到nginx下centos环境,程序是thinkphp3.2的,首页能正常显示,内链所有都是500错误,贴出配置代码和错误日志,求解决方案!!

<br />server {<br />    listen       80;<br />    server_name  此处网站域名;<br />    root   /usr/local/www/web/go;<br /><br />    location / {<br />    root   /usr/local/www/web/go;<br />    index index.php index.html index.htm;<br />        if (!-e $request_filename) {<br />        rewrite ^(.*)$ /index.php/$1 last;<br />        break;<br />    }<br />    <br />        error_page   500 502 503 504  /50x.html;<br />        location = /50x.html {<br />            root   /usr/share/nginx/html;<br />        }<br /> <br />       # pass the PHP scripts to FastCGI server listening on 12<b>6本文来源gao@dai!ma.com搞$代^码!网7</b><pre>搞gaodaima代码

7.0.0.1:9000
location ~ .php$ {
root /usr/local/www/web/go;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#定义变量 $path_info ,用于存放pathinfo信息
set $path_info “”;
#定义变量 $real_script_name,用于存放真实地址
set $real_script_name $fastcgi_script_name;
#如果地址与引号内的正则表达式匹配
if ($fastcgi_script_name ~ “^(.+?\.php)(/.+)$”) {
#将文件地址赋值给变量 $real_script_name
set $real_script_name $1;
#将文件地址后的参数赋值给变量 $path_info
set $path_info $2;
}
#配置fastcgi的一些参数
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
#fastcgi_param SCRIPT_FILENAME /usr/local/www/web/go$fastcgi_script_name;
include fastcgi_params;
}

}

}

nginx日志:

[[email protected]_161_64_centos nginx]# 29068#0: *41 rewrite or internal redirection cycle while processing “/index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php//index.php/home/user/register.html”, client: 这里IP, server: 这里域名, request: “GET /index.php/home:Q

——解决方案——————–
codeigniter在nginx下配置
应该也适用 thinkphp,你对比一下

server {
listen 80;
server_name www.phpno.com;
root /home/www/www_phpno_com/admin_wwwroot;
access_log off;
error_page 404 /404.html;
location /404.html {
root /home/www/www_phpno_com/admin_wwwroot;


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:nginx环境thinkphp,500异常

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址