
Deploy Symfony 6 App On Digital Ocean Droplet

Notes about deploying Symfony applications with Github actions in a droplet.
Prerequisites:
- Ngnix (https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-22-04)
- MySQL(https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-22-04)
- Let’s Encrypt SSL (https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04)
- PHP (https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-22-04)
Add these lines to the Nginx configuration:
root /var/www/project/public;
location / {
try_files $uri /index.php$is_args$args;
}
location /bundles {
try_files $uri =404;
}
For more information visit here.
For deploying automatically in the droplet, configure a GitHub action.
Also, you need to add secrets to actions under your repository settings.
In the script part, you can add or remove lines about your needs.
For example, you can add additional commands.
php bin/console cache:clear # For clearing caches
php bin/console doctrine:migrations:migrate # for migration db
composer install --no-dev --optimize-autoloader # for packages ...