Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aivarasp's avatar

Having trouble hosting laravel on a vps

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04 I've been following this tutorial, but Step 5 — Configuring Nginx when doing sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com sudo nano /etc/nginx/sites-enabled/example.com shows up blank and when I tried copy pasted from sites-available/default and edited it I did the sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/ and then sudo systemctl reload nginx, but my website still didn't show up neither on my domain nor my server site I tried googling it and changing the configs according to other people's answers, but it led me to a 403 then to a 404 then to a 503 then to 500 anyway it eventually led me to a blank page. I think there's a problem between doing the links and making laravel show up from the public folder. Please help

0 likes
4 replies
Snapey's avatar

peel it back to just hosting a simple webpage. Create an html page in a public folder and make sure you can serve that first.

Snapey's avatar

DO = Digital Ocean

OK, so you can serve a page from the public folder using your domain name. Thats great, you already know how to do that - funny you didn't mention it..

Next step is to copy the Laravel code into the folder above public and all the public files into the public folder.

Next step is permissions. You are probably using root or an account you created to admin your droplet. Set the permissions and ownership of the folders that need to be written to by the application

run this from your Laravel folder on your droplet

chgrp -R www-data ./storage ./bootstrap/cache
chmod -R ug+rwx ./storage ./bootstrap/cache

And if you have setup the virtualhost correctly, and tested it with a simple file, you should be good to go.

Please or to participate in this conversation.