【问题标题】:Laravel Forge - Deploying Wordpress + HTTPS is giving "too many redirects"Laravel Forge - 部署 Wordpress + HTTPS 会导致“重定向过多”
【发布时间】:2019-10-01 17:20:41
【问题描述】:

我的 Nginx 配置文件:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/before/*;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.example.com;
    root /home/forge/www.example.com;

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/www.example.com/616559/server.crt;
    ssl_certificate_key /etc/nginx/ssl/www.example.com/616559/server.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/www.example.com/server/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/www.example.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/www.example.com/after/*;

网站域是 www.example.com 别名:example.com

有什么想法吗?

【问题讨论】:

  • 尝试重命名您当前的 .htaccess 文件,然后转到设置>>永久链接并保存永久链接。希望对你有帮助。
  • 当您在浏览器上打开开发者工具时,在网络选项卡下。应用程序在做什么重定向? http 转 https? https转https?如果在你的 wordpress 中强制使用 https?
  • @dineshkashera Laravel forge 使用 Nginx,而不是 Apache。还是谢谢

标签: wordpress nginx laravel-forge


【解决方案1】:

只需将解决方案发布给处于相同情况的任何人:

问题根本不在于发布的 Nginx 配置,这是正确的。 在寻找解决方案一段时间后,我意识到我有两条 DNS 记录(在我的网站和域托管的 DNS 表中)指向 DNS 表中的www.example.com,导致访问网络时出现这种行为。

谢谢。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-14
    • 2018-12-29
    • 2017-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-19
    • 1970-01-01
    相关资源
    最近更新 更多