Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php nginx无限重定向(不是SSL错误)_Php_Nginx_Opencart_Fastcgi - Fatal编程技术网

Php nginx无限重定向(不是SSL错误)

Php nginx无限重定向(不是SSL错误),php,nginx,opencart,fastcgi,Php,Nginx,Opencart,Fastcgi,EDIT:问题是,我不能确切地说,我使用了一个子域,我试着只使用我的TLD(pure)my.de进行配置,瞧,它是开箱即用的。有人知道如何解决这个问题吗? 我目前正在使用这个nginx配置在Ubuntu 12.xx(VPS)上的nginx 1.3.x上的FastCGI(PHP-FPM)上运行OpenCart(v1.5.5.1)(PHP) 当我尝试访问安装文件夹中的index.php时,如下所述:我最终进入了一个无休止的重定向循环: shop.mysite.com/install/shop.mys

EDIT:问题是,我不能确切地说,我使用了一个子域,我试着只使用我的TLD(pure)my.de进行配置,瞧,它是开箱即用的。有人知道如何解决这个问题吗?

我目前正在使用这个nginx配置在Ubuntu 12.xx(VPS)上的nginx 1.3.x上的FastCGI(PHP-FPM)上运行OpenCart(v1.5.5.1)(PHP)

当我尝试访问安装文件夹中的index.php时,如下所述:我最终进入了一个无休止的重定向循环:

shop.mysite.com/install/shop.mysite.com/shop.mysite.com/……etc/index.php

访问日志没有显示任何有用的内容,错误日志也没有显示任何内容

# FORCE WWW
server {
    server_name  .shop.my.de;
    rewrite ^(.*) .shop.my.de$1 permanent;
}
# MAIN SERVER
server {
    error_log    /var/log/nginx/shop.my.de.error.log debug;
    access_log  /var/log/nginx/shop.my.de.access.log;
    server_name  .shop.my.de;
    listen 80;
    root /srv/opencart/upload;
    index index.php;

    location /install {
        index index.php;
    }
    location /image/data {
        autoindex on;
    }
    location /admin {
        index index.php;
    }
    location / {
        try_files $uri @opencart;
    }
    location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }
    location = /favicon.ico {
        log_not_found off;
        #access_log off;
    }
    location = /robots.txt {
        allow all;
        #log_not_found off;
        #access_log off;
    }
    # Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
    location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
        deny all;
    }
    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
        deny all;
        #access_log off;
        #log_not_found off;
    }
    location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
        expires max;
        #log_not_found off;
    }
    location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

解决方案是,如果您希望在子域上使用NGINX+Opencart: 如果您不这样做,opencart将在重定向之间以某种方式疯狂反弹

server {
    server_name  .shop.my.de;
    rewrite ^(.*) www.shop.my.de$1 permanent; # the www is the important thing!!
}


如果禁用重写,会发生什么情况?您运行的是哪个版本的OpenCart?OpenCart 1.5.5.1,我禁用了一些重写(最上面的一个)不会更改。任何其他重写都是确保OpenCart工作的关键。特别是带有
\u路线的重写
我建议尝试。至于无限重定向-安装步骤1没有任何重定向(index.php引导程序也没有,所以不会是这些重定向),那么这一行呢?这似乎是值得怀疑的
location/install{index index.php;}
它基本上说使用opencart index.php文件而不是/install/index.php-EDIT:忽略这一点,我误读了命令。老实说,我不确定。我建议你删除所有不是绝对必要的东西,看看它是否有效——然后开始一次添加一行,非常奇怪。有一点是肯定的——这是一个NGINX问题,而不是OpenCart问题,因此您需要从有NGINX经验的人那里得到答案(我恐怕没有)
server {
    #..........
    server_name  www.shop.my.de; # also HERE! www is the important thing
    #..........
}