SSL laravel forge in default site

∥☆過路亽.° 提交于 2019-12-12 02:01:32

问题


I have read this tutorial to set up SSL for my laravel site. I did not read everything (oops), and did not delete the "default" site. I have generated CSR from default site (but with example.com for domain). Now I have my certificate and i have installed it through laravel forge, but it does not work:

  • cannot connect to https://example.com (browser / curl)
  • http://example.com does not redirect to https
  • Nothing in /var/log/nginx/default-error.log
  • I restarted nginx

Here is my /etc/nginx/sites-available/default file content :

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

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

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/default/XXXXX/server.crt;
    ssl_certificate_key /etc/nginx/ssl/default/XXXXX/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;
    }
}

What can I do to make it work ?


回答1:


Ok, it was a certificate problem. I tried nginx -t and there was an error, now I restarted all the process and everything is alright now.



来源:https://stackoverflow.com/questions/26605296/ssl-laravel-forge-in-default-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!