Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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 在WordPress上强制SSL Nginx时重定向循环_Php_Wordpress_Ssl_Nginx - Fatal编程技术网

Php 在WordPress上强制SSL Nginx时重定向循环

Php 在WordPress上强制SSL Nginx时重定向循环,php,wordpress,ssl,nginx,Php,Wordpress,Ssl,Nginx,我正在开发pizzli.info,它安装在运行Nginx的服务器上。我试图在所有页面上强制使用ssl,但不断遇到重定向循环,这让我抓狂。我已经试着浏览了关于这个问题的每一条信息,但我没有找到任何运气。这是我的配置文件 server{ listen 443; ssl on; ssl_certificate /etc/ssl/pizzli_info.crt; ssl_certificate_key /etc/ssl/pizzli.info.key; pr

我正在开发pizzli.info,它安装在运行Nginx的服务器上。我试图在所有页面上强制使用ssl,但不断遇到重定向循环,这让我抓狂。我已经试着浏览了关于这个问题的每一条信息,但我没有找到任何运气。这是我的配置文件

    server{
listen 443;
ssl on;
 ssl_certificate /etc/ssl/pizzli_info.crt;
        ssl_certificate_key /etc/ssl/pizzli.info.key; 
         proxy_set_header X-Forwarded-Proto https;
              proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header  Host $host;
              proxy_set_header  X-Url-Scheme $scheme;
              proxy_redirect    off;
              proxy_max_temp_file_size 0;
        server_name pizzli.info;
    root /usr/share/nginx/pizzli.info;
        index index.php index.html index.htm;
            location /doc/ {
        alias /usr/share/doc/;
        autoindex on;
        allow 127.0.0.1;
        allow ::1;
        deny all;

    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    proxy_set_header        X-Forwarded-Proto $scheme;
        root /usr/share/nginx/pizzli.info;
    }

    # pass the PHP scripts to PHP-FPM server listening on 127.0.0.1:9000
    location ~ \.(hh|php)$ {
    proxy_set_header        X-Forwarded-Proto $scheme;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    # deny access to .htaccess files, if Apache’s document root
    # concurs with nginx’s one
    #
   # location ~ /\.ht {
    #    deny all;
   # }
   include global/restrictions.conf;

            include global/wordpress.conf;
            location ~* \.html$ {
            proxy_set_header        X-Forwarded-Proto $scheme;
  expires -1;
}

location ~* \.(css|js|gif|jpe?g|png)$ {
proxy_set_header        X-Forwarded-Proto $scheme;
  expires 168h;
  add_header Pragma public;
  add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

        }


        server {
    listen 80 default;
    server_name pizzli.info;
    rewrite ^ https://pizzli.info$request_uri? permanent;
         proxy_set_header X-Forwarded-Proto https;
              proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header  Host $host;
              proxy_set_header  X-Url-Scheme $scheme;
              proxy_redirect    off;
              proxy_max_temp_file_size 0;
    }

您的WordPress似乎正在重定向回http://。您是否在WP设置中到处更新网站地址?它要么是你的WP,要么是你的WP插件/自定义代码。我在我能找到的任何地方都更新了它。wp_选项,如siteurl和home,wpconfig.php,我不确定哪个URL导致循环?您需要使用LiveHTTPHeadersforFirefox之类的工具来分析响应(其他工具也可用)。我看到的是缓存302重定向回您现有的网站-以上是后端服务器的配置吗?