我通常不会发表问题,直到在互联网上对其进行研究直至死活为止.我使用Laravel Forge创建CSR,添加证书,将其激活,使用以下资源编辑Nginx Config:
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;
}
}
我在命令行中执行“服务Nginx重新启动”,然后转到/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指向.我改用namecheap dns,它开始工作.