jeudi 21 avril 2016

Laravel 5 and Cloudflare SSL

Well, today the first time I decided to use ssl on my web project. Firstly, I configured my domain in cloudflare.com. Then I turned on page rules in cloudflare, to automatic redirect the website to https.

http://*example.com/*

To make sure that it works, i added simple index.php to the public_html and it worked. I mean, when I entered to the web site, https was active and the site displayed me the famous word: "Hello World"

After that I uploaded my Laravel project to the web server and configured virtual host. I use nginx server.

server {
        listen 80;

        root /home/user/www/http://ift.tt/1SV0Oyb;
        index index.php index.html index.htm;

        server_name example.com

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;

        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_nam$
                include fastcgi_params;
        }
}

Well, when I enter to the website with https, Laravel routes don't work. Also, my css and js files weren't read by server.

Then I turned off page rules from cloudflare, site worked good with http.

I tried to configure the server with 443, used ssl on command, but wasn't any result.

Also, I found this link about cloudflare with laravel 5. But not sure, this is that, what I want.

Laravel Cloudflare

Any help, would appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire