Fast Setup Virtual Machine and Symfony

sudo dpkg --configure -a
sudo apt-get install mysql-server
apt-cache pkgnames | grep php7.3
php -r "copy('', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

# run this if you are building a traditional web application

composer create-project symfony/skeleton ./ 

# run this if you are building a microservice, console application or API

composer create-project symfony/website-skeleton ./

Current folder should be empty!!!

sudo nano /etc/apache2/sites-available/XXX.conf

    ServerName XXXXXXX

    DocumentRoot /var/www/html/public
    DirectoryIndex index.php

    SetEnv SYMFONY_ENV dev

        AllowOverride All
        Require all granted

        SetHandler proxy:fcgi://

        RewriteEngine On

        RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
        RewriteCond %{DOCUMENT_ROOT}/.maintenance -f
        RewriteCond %{SCRIPT_FILENAME} !maintenance.html
        RewriteRule ^.*$ /maintenance.html [R=503,L]
        ErrorDocument 503 /maintenance.html

        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]

        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
        RewriteRule .? %{ENV:BASE}/index.php [L]

    ErrorLog /var/log/apache2/new_vm_error.log
    CustomLog /var/log/apache2/new_vm_access.log combined

sudo a2ensite XXX
sudo a2enmod rewrite
sudo service apache2 reload
sudo nano /etc/php/7.3/fpm/pool.d/www.conf 

listen =
user = vagrant

sudo service php7.3-fpm restart
sudo apt-get install -y git

Leave a Reply

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