HTTP2 Apache2 Webseite: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
Zeile 17: Zeile 17:
 
                 ServerName $FQDN
 
                 ServerName $FQDN
 
ServerAdmin webmaster@localhost
 
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/$FQDN
+
DocumentRoot /var/www/html/$COMMONNAME
ErrorLog \${APACHE_LOG_DIR}/$FQDN-error.log
+
ErrorLog \${APACHE_LOG_DIR}/$COMMONNAME-error.log
CustomLog \${APACHE_LOG_DIR}/$FQDN-access.log combined
+
CustomLog \${APACHE_LOG_DIR}/$COMMONNAME-access.log combined
 
SSLEngine on
 
SSLEngine on
SSLCertificateFile /etc/apache2/$FQDN.crt
+
SSLCertificateFile /etc/apache2/$COMMONNAME.crt
SSLCertificateKeyFile /etc/apache2/$FQDN.key
+
SSLCertificateKeyFile /etc/apache2/$COMMONNAME.key
 
SSLCACertificateFile /etc/apache2/ca.crt
 
SSLCACertificateFile /etc/apache2/ca.crt
 
<FilesMatch "\.(cgi|shtml|phtml|php)$">
 
<FilesMatch "\.(cgi|shtml|phtml|php)$">

Version vom 18. Oktober 2023, 12:03 Uhr

Diverse Module aktivieren

  • a2enmod ssl

Cert und Key Dateien plazieren

  • FQDN="xinux.de"
  • cp /home/xinux/cert/*.{key,crt} /etc/apache2
  • ls /etc/apache2/*.{key,crt}
/etc/apache2/ca.crt  
/etc/apache2/www.xinux.de.crt  
/etc/apache2/www.xinux.de.key

Conf erstellen

  • cd /etc/apache2/sites-available
  • cat<<HERE>$COMMONNAME.conf
<IfModule mod_ssl.c>
	<VirtualHost _default_:443>
                ServerName $FQDN
		ServerAdmin webmaster@localhost
		DocumentRoot /var/www/html/$COMMONNAME
		ErrorLog \${APACHE_LOG_DIR}/$COMMONNAME-error.log
		CustomLog \${APACHE_LOG_DIR}/$COMMONNAME-access.log combined
		SSLEngine on
		SSLCertificateFile /etc/apache2/$COMMONNAME.crt
		SSLCertificateKeyFile /etc/apache2/$COMMONNAME.key
		SSLCACertificateFile /etc/apache2/ca.crt
		<FilesMatch "\.(cgi|shtml|phtml|php)$">
				SSLOptions +StdEnvVars
		</FilesMatch>
		<Directory /usr/lib/cgi-bin>
				SSLOptions +StdEnvVars
		</Directory>
	</VirtualHost>
</IfModule>
HERE

Verzeichnis anlegen

  • mkdir /var/www/html/$FQDN
  • cp /var/www/html/index.html /var/www/html/$FQDN

Aktivieren

  • a2ensite $FQDN

Reload

  • systemctl restart apache2