【发布时间】:2020-06-14 18:28:04
【问题描述】:
我已经设置了我的服务器并在 Vultr VPS 上部署了项目,我正在尝试为我的域设置重定向,但我不断收到此错误 This page isn’t working henryestate.xyz redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
我试图编辑我的etc/nginx/sites-enabled/default
我有以下代码:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
listen 443 ssl;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/laravel/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm;
server_name henryestate.xyz www.henryestate.xyz;
return 301 https://henryestate.xyz$request_uri;
ssl_certificate /etc/nginx/ssl/cert_chain.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
我如何对这个 https 重定向进行排序,以允许网站在 www 和非 www 时都使用 https 加载
【问题讨论】: