Deploying Symfony on Wedos

I spent several hours deploying my Symfony-based website to Wedos. I couldn’t find any clear step-by-step guide that actually worked, so I decided to write my own. I’m using Symfony 7.3.3.

Preparing the Code

Steps to prepare your application for production.

Install vendors for production

composer install --no-dev --optimize-autoloader

Clear the cache

APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear

Warm up the cache

php bin/console cache:warmup --env=prod --no-debug

Compile JS and CSS

php bin/console asset-map:compile

Export environment variables

composer dump-env prod

Uploading the Files

Upload the following files to your server:

/config/, /src/, /templates/, /translations/, /public/, composer.json, composer.lock, .env.local.php, /vendor/

On the Wedos Side

Wedos has quite strict rules regarding the use of .htaccess directives. Many of them are disabled, so here are the adjustments that helped me make my website work.

  1. Edit the root .htaccess to redirect to the /public folder

    Symfony keeps its index.php file in the public folder, so you need to redirect requests there. I uploaded my project into /www/blog/.

    RewriteCond %{HTTP_HOST} ^myblog.fck$
    RewriteCond %{REQUEST_URI} !^/blog/public/
    RewriteRule (.*) /blog/public/$1 [L]

    This block should be placed right after “RewriteEngine On”.

  2. Edit the .htaccess file in /public

    You need to remove or comment out the following directives, as they are not allowed on Wedos.

    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    Options +SymLinksIfOwnerMatch
  3. Fix folder and file permissions

    If the public folder doesn’t have sufficient permissions, set 755 for directories and 644 for files.