Answer the question
In order to leave comments, you need to log in
What is wrong with my Apache config?
What is wrong with my config?
does not enter the site through www.site.com - the browser writes NET::ERR_CERT_COMMON_NAME_INVALID
and the site uses the hsts protocol!
<VirtualHost *:80>
ServerName site.com
ServerAlias *.site.com
ServerAlias site.com
ServerAdmin [email protected]
Redirect 301 / https://site.com/
</VirtualHost>
<IfModule mod_ssl.c>
SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
<VirtualHost *:443>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
ServerName site.com
ServerAdmin [email protected]
RewriteEngine On
RewriteOptions inherit
# Redirect
RewriteCond %{HTTP_HOST} !^site\.com$ [NC]
RewriteRule ^ https://site.com%{REQUEST_URI} [L,R=301]
# Indexes + Directory Root.
DocumentRoot /home/www/site.com/
AddDefaultCharset utf-8
<Directory "/home/www/site.com">
Options None
AllowOverride All
Require all granted
Options Indexes FollowSymLinks
</Directory>
ErrorLog /home/www/site.com/error.log
# SSL
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl/site/www.site.com.key
SSLCertificateFile /etc/apache2/ssl/site/2_www.site.com.crt
SSLCACertificateFile /etc/apache2/ssl/site/1_root_bundle.crt
SSLUseStapling on
</VirtualHost>
</IfModule>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question