andreapollastri / cipi

Install and manage your server like a pro! With Cipi you don’t need to be a Sys Admin to deploy and manage websites and PHP applications powered by cloud VPS.
https://cipi.sh
1.08k stars 223 forks source link

At least somebody can show us force https nginx.conf ? #404

Closed erenergul closed 2 years ago

erenergul commented 2 years ago

Hello , I read all documents and all request and errors but I couldn't find any sample. How to force laravel app https ? I found lots of solutions but nothing worked. I really dont understand and I dont want to spend 6 hours to fix force https ? Can you let us know how to do it ? Any example code ?

ssh to website user and sudo nano conf file like below I dont know any nginx configuration so i tried. :

server { listen 80 default_server; servername ; return 301 http://example.com$request_uri; } -> ofc with my url and details but it broke nginx. I have no idea why.

I tried to add AppServiceProvider boot method Url:: to force https. It doesnt work as well. Its really annoying to do that manual.

nikgodda commented 2 years ago

Run ssh cipi@<server-ip>

Run sudo nano /etc/nginx/sites-enabled/<app-user>.conf

Edit configuration

server {
       listen         80;
       listen         [::]:80;
       server_name    goddafit.space;
       return         301 https://$server_name$request_uri;
}

server {
    server_tokens off;

    server_name goddafit.space;

    root /home/cp2806f7527/web/public;

    client_body_timeout 10s;
    client_header_timeout 10s;
    client_max_body_size 256M;
   ...

Run sudo systemctl restart nginx.service