Minimal VirtualHost Config
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/html/;
index index.html;
location / {
try_files $uri $uri / =404;
# try_files $uri /index.html =404;
}
# ## OPTIONAL: Always Redirect http to https ###
# return 301 https://example.com$request_uri;
}
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks
DirectoryIndex index.html index.php
AllowOverride All
Require all granted
## Allow from all
</Directory>
### OPTIONAL: Always Redirect http to https ###
# RewriteEngine on
# RewriteCond %{SERVER_NAME} =example.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>