To run Symfony on an Ubuntu VPS, install a supported PHP runtime (the current Symfony setup documentation requires PHP 8.4 or newer), the extensions listed by Symfony, Composer, Git and unzip. Use Symfony CLI if you want its requirement checks and project commands. For production, point Nginx or Apache at your project’s public/ directory and pass PHP requests to PHP-FPM; the Symfony CLI server is intended for development only.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What you need before installing Symfony
A VPS gives you root or sudo access, but it does not provide a Symfony-ready stack automatically. Prepare these pieces first.
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →| Component | Why it is needed | What to verify |
|---|---|---|
| Ubuntu VPS | Hosts the operating system, application files and services. | You can connect over SSH and use sudo. |
| PHP | Runs Symfony and its console commands. | The installed release meets the current Symfony requirement of PHP 8.4 or higher. |
| PHP extensions | Provide the functions used by Symfony components and your bundles. | Install every extension named on Symfony’s current setup page; the package names differ between Ubuntu releases. |
| Composer | Resolves and installs PHP dependencies. | composer --version returns a version without an error. |
| Git and unzip | Fetch source code and unpack dependency archives. | Both commands run from your shell. |
| Web server | Accepts HTTP requests and serves static files. | Use Nginx or Apache with PHP-FPM for a conventional VPS deployment. |
| Symfony CLI (optional) | Checks requirements, creates projects, selects PHP versions and runs a local development server. | symfony -V prints the CLI version. |
Make a note of the PHP-FPM socket created on your VPS. A common path is /var/run/php/php8.4-fpm.sock, but the actual filename depends on the PHP package you installed.
Prepare Ubuntu
Update package metadata and install base tools
Connect over SSH and update the package index before installing the runtime tools:
#1 Best Overall
sudo apt update
sudo apt install php-cli php-fpm composer git unzip nginx
These package names ask Ubuntu for its available PHP CLI and FPM packages. If that repository supplies an older PHP release, use an Ubuntu package source that provides the supported release, then install the matching CLI, FPM and extension packages. Do not continue until the command below reports a supported version.
php -v
Install the required PHP extensions
Symfony’s setup documentation lists the core extensions required by the current release. Install the corresponding Ubuntu packages for every item on that list. Extension names can change with the PHP version and Ubuntu distribution, so copy the list for your exact environment rather than installing an arbitrary bundle. Check what is loaded with:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →php -m
The CLI and FPM installations should use the same PHP major and minor release. If php -v and the PHP-FPM service refer to different releases, Composer may resolve dependencies successfully while web requests fail later.
Check Composer, Git and unzip
composer --version
git --version
unzip -v | head -n 1
Composer can be installed from Ubuntu packages or by Composer’s official installer. Whichever method you use, keep Composer available to the same deployment account that will run your Symfony commands. Running Composer as root can leave a project with ownership that the web server cannot read or update.
Install Symfony CLI on Ubuntu
The Symfony CLI is free, open-source tooling for building, running and managing Symfony applications from a terminal. It is not required to serve a production site, but it makes requirement checks, project creation and local diagnostics easier.
Use the documented APT repository
- Open Symfony’s current CLI installation page and run the Cloudsmith APT setup script for Ubuntu exactly as documented there. The script adds the signing key and repository for the CLI package.
- Install the package:
sudo apt install symfony-cli
- Confirm that the command is available:
symfony -V
The same CLI documentation also describes an installer script and a standalone binary. Those alternatives are useful when you cannot add an APT repository, but keep the binary on the system PATH for the account that performs deployments.
Run the requirement check
symfony check:requirements
Read every failure instead of treating this as a pass/fail formality. A missing extension, an old PHP binary or an inaccessible configuration file will be reported here. Correct the package or PATH issue, then run the check again.
Create a new Symfony project
Choose the project command based on what you are building. Run it as the non-root user who will own the code, in the directory where you keep applications.
Full web application
symfony new --webapp my_project
The --webapp option installs the common components for a conventional website, including the dependencies typically needed for HTTP controllers, templates, forms and persistence.
Minimal, API or console application
symfony new my_project
Use the minimal form for a microservice, API or console-oriented project, then add only the bundles your application needs with Composer.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Select a Symfony version
The CLI accepts a --version option. You can request a specific release or the long-term-support line exposed by the CLI:
symfony new --version=lts my_project
Run symfony new --help if your installed CLI uses a different option spelling. Pinning a version is preferable for a production build because it makes a rebuild deterministic; do not select a branch that your installed PHP version cannot support.
Rank #3
After creation, move into the project and inspect its files:
cd my_project
php bin/console about
The about command displays the Symfony version, environment and important runtime information. Treat that output as a quick sanity check before adding application code.
Recommended Free Tools
Deploy an existing Symfony project
When the project already exists in a Git repository, do not create a second skeleton. Reproduce the repository’s dependency and configuration steps on the VPS.
- Clone the repository into a directory such as
/var/www/projectand enter it. - Install the locked dependencies:
git clone <repository-address> /var/www/project
cd /var/www/project
composer install
For a production build, use the flags required by your Composer and application policy, commonly --no-dev and --optimize-autoloader. Keep the project’s lock file so every server receives the versions that were tested.
- Provide configuration values. Local development files can use
.envand.env.local; production should use real environment variables or the configuration mechanism supplied by your hosting platform. Do not commit database passwords, API keys or other secrets. - Complete the application’s own setup: create or grant the database, configure a message queue or mail transport if the project uses one, load fixtures only when appropriate, and run the migrations documented by that project.
- Inspect the resulting installation:
php bin/console about
If about fails, fix the PHP version, extensions, environment variables or missing dependencies before configuring Nginx. A web server cannot compensate for an incomplete application bootstrap.
Use Symfony’s local server for development
From the project directory, start the development server with:
Rank #4
symfony server:start
The CLI prints the local address and keeps the process attached to your terminal. For a background process, use:
symfony server:start -d
Useful diagnostics are:
| Command | Use |
|---|---|
symfony server:status |
See whether the local server is running and which address or port it uses. |
symfony server:log |
Read the server and application output while reproducing a request. |
symfony server:stop |
Stop a background server that is holding a port or running stale code. |
This server is a development convenience. It is not the production web server for a public VPS: it is not the place to terminate TLS, enforce your hardened Nginx rules, or supervise a production workload.
Choose a production deployment model
| Approach | Operational control | Server stack | Who handles updates and backups | Scaling path |
|---|---|---|---|---|
| Self-managed Ubuntu VPS | Full control of Ubuntu, PHP, Nginx and firewall settings. | Usually Nginx with PHP-FPM; Apache is also supported. | You maintain the operating system, runtime, monitoring and backups. | Resize the VPS, add replicas or introduce a load balancer as traffic grows. |
| Managed Symfony hosting | Less control over the host, more control over the application. | The provider supplies a supported PHP web stack and deployment workflow. | The provider may handle infrastructure tasks; confirm backup retention and observability in its current terms. | Use the platform’s documented scaling controls. |
| Symfony Cloud deployment | Integrated Symfony-oriented deployment rather than a server you administer directly. | Platform-managed runtime and web serving. | Follow the platform’s current deployment, logging and backup documentation. | Use the platform’s environment and scaling model. |
For a VPS tutorial, the self-managed Nginx/PHP-FPM layout below is the most transparent. A managed platform can reduce patching work, but verify its PHP versions, environment-variable handling, logs, backups and recovery process before committing a production application.
Configure Nginx and PHP-FPM
Set the document root to public/
Symfony’s public directory is the home of public and static files, including images, stylesheets and JavaScript. It is the only project directory that should be directly exposed by the web server. If your code lives at /var/www/project, set the Nginx root to /var/www/project/public, not the repository root.
Route requests through the front controller
Create a server block for your hostname. The following pattern sends existing static files directly, forwards other paths to index.php, allows that front controller to reach PHP-FPM internally, and returns 404 for unrelated PHP files:
server {
listen 80;
server_name example.com;
root /var/www/project/public;
index index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index.php(/|$) {
internal;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
location ~ .php$ {
return 404;
}
}
Change server_name to your hostname and confirm the socket name with ls /var/run/php/. If PHP-FPM listens on TCP instead, replace the fastcgi_pass value with the address configured by its pool. The internal directive means a browser cannot request the front controller directly; Nginx can invoke it only through the internal rewrite.
Best Value
Enable and test the configuration
- Place the server block in the location used by your Ubuntu Nginx package, then enable it according to your site’s existing layout.
- Validate syntax:
sudo nginx -t
- Reload Nginx and ensure PHP-FPM is enabled and running:
sudo systemctl reload nginx
sudo systemctl status php8.4-fpm
Use the service name installed on your VPS if it differs. Open the site and exercise a route that is handled by Symfony as well as a static asset. After deployment, explicitly test /index.php; it should not be publicly reachable. A successful application response must come through the rewritten route, not a direct request to the script.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteSet permissions and production configuration
Make runtime directories writable
Symfony writes compiled cache and logs under var/cache/ and var/log/. The web-server user and the deployment process both need appropriate access. Grant write permission to those directories without making the entire project world-writable. On Ubuntu the web user is often www-data, but verify the user configured by your Nginx/PHP-FPM pool.
sudo chown -R www-data:www-data /var/www/project/var/cache /var/www/project/var/log
If deployments run as a separate account, use a shared group or ACL strategy so that account can replace cache files without changing ownership of the whole codebase. A permission error in these directories commonly appears as a 500 response or a failed console command.
Keep secrets outside committed files
Production values should come from real environment variables or your hosting platform’s secret/configuration facility. Set the application environment, database URL and other sensitive values in the process environment used by PHP-FPM and deployment jobs. Review the effective values from the server rather than assuming the development .env file is being read. Never place credentials in Git, a public directory or an Nginx configuration that is downloadable as a backup.
Deploy updates safely
Use a repeatable order whenever you release a new commit:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall- Put the application in maintenance mode if its traffic pattern requires a coordinated release.
- Fetch the intended Git commit and install dependencies with Composer using the project’s production flags.
- Apply database changes using the migration procedure documented by the application.
- Update production environment variables through the server or hosting platform’s mechanism.
- Clear or warm Symfony’s production cache when the release requires it, using the commands documented by the project.
- Reload PHP-FPM only when configuration or a long-running worker requires it; reload Nginx after a server-block change.
- Request the homepage, an application route and a static asset, then inspect Nginx, PHP-FPM and Symfony logs.
Take a database and file backup before migrations and retain a tested restore path. A backup that has never been restored is not a recovery plan.
Quick Recap
Troubleshoot common failures
| Symptom | Likely cause | Checks and fix |
|---|---|---|
symfony check:requirements reports a failure |
Unsupported PHP release, missing extension or an incorrect CLI binary. | Compare php -v and php -m with the current setup requirements, install the matching packages, and run the check again. |
| The local server will not start | An existing process owns the port or a previous process is stuck. | Run symfony server:status, inspect symfony server:log, stop the stale process with symfony server:stop, then start it again. |
| Nginx returns 404 for every Symfony route | The root points at the repository instead of public/, or try_files is missing. |
Check the server block’s root and front-controller rule, run sudo nginx -t, and reload Nginx. |
| Nginx returns 502 Bad Gateway | PHP-FPM is stopped or Nginx is using the wrong socket or TCP address. | Check the PHP-FPM service status, list /var/run/php/, compare the pool’s listen setting with fastcgi_pass, and inspect the Nginx error log. |
A request exposes a PHP file or /index.php |
The server block allows arbitrary PHP execution or the front controller is not marked internal. | Keep the dedicated front-controller location, return 404 for other PHP paths, reload Nginx, and verify that a direct /index.php request is rejected. |
| Symfony cannot write cache or logs | The PHP-FPM user lacks write access to var/cache/ or var/log/. |
Confirm the pool user and correct ownership or group/ACL permissions on only those runtime directories. |
| The site uses unexpected database or debug settings | Production environment variables are absent, misspelled or overridden by local development files. | Inspect the environment supplied to PHP-FPM and the deployment service; set real production values and remove accidental development overrides. |
Production checklist
- PHP and every required extension satisfy the current Symfony setup requirements.
- Composer dependencies are installed from the committed lock file.
- The application directory is owned by a controlled deployment account, not writable by every user.
- Nginx or Apache serves only
public/. - PHP-FPM is running and the configured socket or TCP address matches the web-server setting.
- Only the front controller can execute PHP; unrelated PHP files return 404.
- A direct request to
/index.phpis rejected after deployment. var/cache/andvar/log/are writable by the runtime user.- Secrets come from real environment variables or a hosting secret store.
- Database migrations, backups, logs and rollback steps are documented for the project.
- The Symfony CLI server is used only for local development, not as the public production listener.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




