-
Notifications
You must be signed in to change notification settings - Fork 0
Apache2
Filip Krzyżanowski edited this page Nov 12, 2022
·
1 revision
You need to rename all domain.com
with yours domain name
The -p
flag create a /websites
folder if you don't have it
sudo mkdir -p /websites/domain.com
sudo nano /etc/apache2/sites-available/domain.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /websites/domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /websites/domain.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# SSL certificate, from HTTP to HTTPS
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.com [OR]
RewriteCond %{SERVER_NAME} =www.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
sudo systemctl restart apache2
sudo a2ensite domain.com.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
If you want host something on default host (000-deafult.conf
) - for example: RoundCube - you need to set <Directory>
tag in this Virtual Host like this:
sudo nano /etc/apache2/sites-available/000-default.conf
And under CustomLog ${APACHE_LOG_DIR}/access.log combined
line you must put this lines
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>