-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapache.conf
More file actions
42 lines (39 loc) · 1.29 KB
/
apache.conf
File metadata and controls
42 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Write this in /etc/apache2/apache2.conf
# It is good to keep all directories except the website directory inaccessable.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
# Keep the default directory inaccessable. In case access site use IP instead of domain.
<Directory /var/www/html>
AllowOverride None
Require all denied
</Directory>
# Only the website directory can be accessed.
<Directory /var/www/mysite>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# Redirect all HTTP request to HTTPS
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com # Let certbot to include this commonly used subdomain
ServerAlias *.example.com
<If "%{HTTP_HOST} != 'example.com'"> # Use no-subdomain as canonical
Redirect permanent / https://example.com/
</If>
DocumentRoot "/var/www/mysite/"
ServerAdmin admin@example.com
RewriteEngine on
RewriteRule ^.*$ /index.php [QSA,L] # Use index.php as the entry point, actual path will be provided in $_SERVER["SCRIPT_URL"]
# Include Generated-by-Certbot
# SSLCertificateFile Generated-by-Certbot
# SSLCertificateKeyFile Generated-by-Certbot
</VirtualHost>