Skip to content

Instantly share code, notes, and snippets.

@anatoliy-t7
Last active October 14, 2022 04:08
Show Gist options
  • Save anatoliy-t7/81400880f9db53be06557e1ed1b785da to your computer and use it in GitHub Desktop.
Save anatoliy-t7/81400880f9db53be06557e1ed1b785da to your computer and use it in GitHub Desktop.
Setup Apache for laravel to current folder
sudo nano /etc/apache2/sites-available/your_domain.conf
sudo a2ensite your_domain.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
sudo systemctl restart apache2
sudo a2enmod rewrite
sudo nano /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo systemctl restart apache2
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/GITREPOSITORY/current/public
<Directory "/var/www/GITREPOSITORY/current/public">
Options FollowSymLinks MultiViews
Order Allow,Deny
Allow from all
ReWriteEngine On
</Directory>
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Redirect permanent / https://domain.com
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment