cd /etc/apache2/sites-available
cp 000-default.conf project-name.conf
nano project-name.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/project/public
ServerName project.mx
ServerAlias project.mx
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/project/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.project.mx [OR]
RewriteCond %{SERVER_NAME} =project.mx
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName project.mx
ServerAlias project.mx
DocumentRoot /var/www/project/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/project/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl-certificate/private-key.pem
SSLCertificateFile /etc/apache2/ssl-certificate/csr.pem
SSLCertificateChainFile /etc/apache2/ssl-certificate/bundle.crt
</VirtualHost>
</IfModule>
a2ensite project-name
sudo service apache2 restart
cd /path/to/project/
sudo chown -R www-data storage public
If your application is on another port, you must add the following line to ports.conf
Listen 80
Listen 8085