Here’s a clear step-by-step guide for deploying your Symfony application on a Plesk server that already has PHP and PostgreSQL installed, and your code is hosted on GitHub:
1. Prepare Your Plesk Environment
-
Login to Plesk.
Go to your Plesk dashboard. -
Create a Domain or Subdomain.
-
Websites & Domains → Add Domain/Subdomain.
-
-
Enable Git support in Plesk.
-
Plesk has a Git extension (usually preinstalled).
-
If not, install it from Extensions → Git.
-
2. Connect Your GitHub Repository
-
Go to your domain in Plesk → Git.
-
Add a new repository:
-
Repository URL: Paste your GitHub HTTPS/SSH link.
-
Deployment mode: Choose Automatically deploy on push (if you want auto-deployment).
-
Deployment path: Set to
httpdocs
or another folder (e.g.,httpdocs/myapp
).
-
-
If using private repo, configure deployment key in GitHub and Plesk.
3. Configure Symfony in Plesk
-
Set document root:
-
By default, Symfony’s public entry point is
/public
. -
In Plesk → Hosting Settings → Document root =
httpdocs/public
.
-
-
Install Composer dependencies:
You’ll need to rely on Plesk tools inside the GUI:
-
Composer in Plesk GUI
-
Go to Domains → [Your Domain] → PHP Composer.
-
Plesk can run
composer install
for you from the panel without SSH. -
You can add custom commands (like
cache:clear
) as post-deployment hooks.
-
-
Git Deployment Hook (No SSH Needed)
In Plesk → Git → Repository Settings, you can set a Deployment Script.
Example (runs after every deploy):(Make sure to pick the right PHP path version in Plesk.)
-
-
Set permissions for Symfony cache/logs:
4. Configure Environment and Database
-
Copy
.env
to.env.local
in the project root. -
Update DB connection string for PostgreSQL:
5. Configure PHP in Plesk
-
In Plesk → PHP Settings:
-
Choose PHP version compatible with Symfony (8.1+ recommended).
-
Enable extensions:
pgsql
,pdo_pgsql
,mbstring
,xml
,intl
,ctype
,tokenizer
,json
. -
Increase
memory_limit
(e.g.,512M
) andmax_execution_time
(e.g.,120
).
-
6. Configure Web Server (Optional for Performance)
-
If using Apache + Nginx, ensure
.htaccess
or Nginx rules are correct. -
Symfony requires
index.php
fallback. In Nginx, add:
7. Test Deployment
-
Open your domain in the browser.
-
You should see the Symfony welcome page or your app’s homepage.
-
Check logs if issues occur: