用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4068|回复: 3
收起左侧

[Others] CI2.2框架在nginx1.2出现502 Bad Gateway

[复制链接]
发表于 2016-12-12 17:02:40 | 显示全部楼层 |阅读模式
本帖最后由 eremiter 于 2016-12-13 10:31 编辑

下载一个jekpos2.3.4, https://github.com/jekkos/opensourcepos 在apache运行正常
但在nginx1.2 因PATH_INFO问题,可以登入首页,但输入用户名和密码,就会提示页面不存在。
于是搜索相关教程设置。变成连首页都无法看到了。提示502 Bad Gateway注:nginx1.2.7是正常的,因另一网站dedecms可以正常运行

环境:centos6.3 nginx1.2.7

pos.test.cn 域名我换了一下,实际不是test


PHP复制代码
 
server {
        listen       80;
        server_name  pos.test.cn;
 
        root   /home/wwwroot/pos;
        index index.php index.html default.php;
 
        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
 
        location ~ \.php($|/) {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param   PATH_INFO $fastcgi_path_info;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
 
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires      30d;
       }
       location ~ .*\.(js|css)?$ {
            expires      12h;
       }
 
        location ~ /\.ht {
                deny  all;
        }
}
 
复制代码


下面的配置 ,可以登入首页,但输入用户名和密码,跳转到一页面,提示找不到,应该是控制器pathinfo问题

PHP复制代码
 
server
        {
                listen       80;
                server_name   pos.test.cn;
                index index.html index.htm index.php default.php default.html;
                root  /home/wwwroot/pos;
 
                location ~ .*\.(php|php5)?$
                        {
                                try_files $uri =404;
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }
 
                location /status {
                        stub_status on;
                        access_log   off;
                }
 
                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }
 
                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }
 
        }
 
 
 
复制代码



发表于 2016-12-12 17:14:02 | 显示全部楼层
nginx 配置参考 https://www.nginx.com/resources/ ... ecipes/codeigniter/ 不要在网上搜索,很多不靠谱。
 楼主| 发表于 2016-12-12 20:29:28 | 显示全部楼层
Hex 发表于 2016-12-12 17:14
nginx 配置参考 https://www.nginx.com/resources/wiki/start/topics/recipes/codeigniter/ 不要在网上搜索 ...

谢谢版主,这个网站无法打开,估计也是全英文,看得也累

我干脆再去下载3.0 ,在apache2.4安装成功,但里面的菜单 store config 一点击就会卡死,郁闷
nginx的配置要php5.5,目前是php5.3,pos3又不支持,嗨

我的环境win10+php5.5+mysql5.5,你有空试一下嘛,谢谢
发表于 2016-12-13 15:21:16 | 显示全部楼层
eremiter 发表于 2016-12-12 20:29
谢谢版主,这个网站无法打开,估计也是全英文,看得也累

我干脆再去下载3.0 ,在apache2.4安装成功,但里 ...

网站打不开可能需要科学上网,另外英文内容是很有价值的。

关于你这个开源项目,我建议直接联系作者比较好,因为这可能已经不只是 CI 框架的问题了。我没有使用过这个项目,可能帮不到你。。。

本版积分规则