❓ Support
Manuel Manuel Jun 9, 2023

Struggling with setup on Laravel Forge

I've been running Waterhole locally and the installation was indeed a smooth and rewarding experience! However, I just use php artisan serve to run the local instance as I'm pretty much dreading server setups.

So I tried to go with Laravel Forge to set up a live instance but it seems I'm still missing the right configuration. The app is running and the site is being served, but the storage-link in the public folder is not generated and no styles or scripts are applied.

The public/storage folder on the server:

image.png

The nginx server config is just the defaults on Forge, plus the recommendations.

Answered by Manuel Manuel

Ok, up now! Had to do two additional steps:

  • manually add the link to static files in the public folder:
    ln -s /home/forge/<your-sitename>/storage/app/public/ storage
  • add a SSL Certificate and then adjust APP_URL in the environment configuration to serve from https.
View Answer

⁨7⁩ ⁨Comments⁩

In reply to Manuel Manuel

Sorry for my limited English expression. I am not very familiar with Apache or Nginx, and I just threw your question at ChatGPT. 😅
Then it told me that, first, you need to check the folder permissions:

Please make sure you have set the correct folder permissions on the server. You can use the following commands to change the folder permissions:

sudo chown -R www-data:www-data /home/forge/waterhole.kostka.studio/storage
sudo chown -R www-data:www-data /home/forge/waterhole.kostka.studio/public
sudo chmod -R 755 /home/forge/waterhole.kostka.studio/storage
sudo chmod -R 755 /home/forge/waterhole.kostka.studio/public
In reply to Manuel Manuel

I was able to solve the issue by creating another .htaccess in the root folder to get the public folder

.htaccess must contain this

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L]

If it work drop a like 🤞

@Subarist Yeah, I don't think that's the right direction. It would also be weird if I'd need to access the server console to correct folder permissions when I use Forge to set them up correctly in the first place.

Thank you @Adeala Ademola! I guess that's also related to using Apache though.

The site is served from the public folder, so the folder is accessible and all. The issue I see is that the symlink storage -> /storage/app/public is not generated in the public folder. And when I add it manually, it's not used.

Answer

Ok, up now! Had to do two additional steps:

  • manually add the link to static files in the public folder:
    ln -s /home/forge/<your-sitename>/storage/app/public/ storage
  • add a SSL Certificate and then adjust APP_URL in the environment configuration to serve from https.