gpt4 book ai didi

php - 用于 SSL 的 Laravel Forge Nginx 配置

转载 作者:可可西里 更新时间:2023-11-01 01:00:57 26 4
gpt4 key购买 nike

我通常不会发布问题,直到我在 Internet 上彻底研究它。我使用 Laravel Forge 创建 CSR,添加证书,激活它,使用这些资源编辑 Nginx 配置:

https://stackoverflow.com/questions/26192839/laravel-forge-ssl-certificate-not-working

^curl https://domain.com返回数据

server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}

server {
listen 443 ssl;
server_name example.com www.example.com;
root /home/forge/example.com/public;

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

index index.html index.htm index.php;

charset utf-8;

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/default-error.log error;

error_page 404 /index.php;

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

location ~ /\.ht {
deny all;
}
}

我在命令行中执行“service nginx restart”,然后转到/var/log/nginx/error.log 并看到以下错误:

'conflicting server name "" on 0.0.0.0:80, ignored'
'conflicting server name "www.domain.com" on 0.0.0.0:80, ignored'

当我访问 domain.com 时,它被重定向到 https://domain.com与'这个网页有一个重定向循环'。显然 Nginx 重定向无法正常工作,但我已按照所有步骤操作。

请告诉我应该发布哪些额外的错误日志和信息来解决此问题。任何帮助将不胜感激,在此先感谢。

最佳答案

好吧,问题比我想象的要简单。我正在使用不支持 ssl 的免费 cloudflare dns 指向。我改用 namescheap dns,它开始工作了。

关于php - 用于 SSL 的 Laravel Forge Nginx 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26815723/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com