2014-11-08 126 views
3

我通常不會發布問題,直到我在互聯網上研究它死亡。我創建一個使用Laravel僞造CSR,添加證書,激活它,利用這些資源編輯Nginx的配置:Laravel Forge Nginx配置SSL

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

^捲曲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.co m,它會被重定向到https://domain.com'此網頁有一個重定向循環'。顯然,Nginx重定向不起作用,但我已經遵循了所有步驟。

請讓我知道我應該發佈什麼額外的錯誤日誌和信息來解決這個問題。任何幫助將不勝感激,在此先感謝。

+0

請確保您沒有任何默認配置,如/etc/nginx/conf.d/default.conf – Anatoly 2014-11-09 18:05:04

回答

3

沒關係,所以問題比我想象的要簡單。我正在使用不支持ssl的免費cloudflare dns指向。我切換到使用namescheap dns,它開始工作。

0

花了一些時間研究nginx之後,我想補充一點,當你添加一個證書時,你必須在下載後手動按下「激活它」。