Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Install and Get Started With Symfony on an Ubuntu VPS (2026 Guide)

Install Symfony on an Ubuntu VPS with the supported PHP runtime, Composer and Symfony CLI, then deploy safely behind Nginx and PHP-FPM using the public/ document root.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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:

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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

  1. 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.
  2. Install the package:
sudo apt install symfony-cli
  1. 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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
Sale
The Definitive Guide to symfony
  • Used Book in Good Condition

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

  1. Clone the repository into a directory such as /var/www/project and enter it.
  2. 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.

  1. Provide configuration values. Local development files can use .env and .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.
  2. 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.
  3. 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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Enable and test the configuration

  1. Place the server block in the location used by your Ubuntu Nginx package, then enable it according to your site’s existing layout.
  2. Validate syntax:
sudo nginx -t
  1. 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Set 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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Put the application in maintenance mode if its traffic pattern requires a coordinated release.
  2. Fetch the intended Git commit and install dependencies with Composer using the project’s production flags.
  3. Apply database changes using the migration procedure documented by the application.
  4. Update production environment variables through the server or hosting platform’s mechanism.
  5. Clear or warm Symfony’s production cache when the release requires it, using the commands documented by the project.
  6. Reload PHP-FPM only when configuration or a long-running worker requires it; reload Nginx after a server-block change.
  7. 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.

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.php is rejected after deployment.
  • var/cache/ and var/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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.