HTTP2 Apache2 Webseite: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
Zeile 14: Zeile 14:
 
*cat<<HERE>$FQDN.conf
 
*cat<<HERE>$FQDN.conf
 
<pre>
 
<pre>
<VirtualHost *:80>
+
<IfModule mod_ssl.c>
        ServerName $FQDN
+
<VirtualHost _default_:443>
        ServerAdmin webmaster@localhost
+
                ServerName $FQDN
        DocumentRoot /var/www/html/$FQDN
+
ServerAdmin webmaster@localhost
        ErrorLog \${APACHE_LOG_DIR}/$FQDN-error.log
+
DocumentRoot /var/www/html/$FQDN
        CustomLog \${APACHE_LOG_DIR}/$FQDN-access.log combined
+
ErrorLog \${APACHE_LOG_DIR}/$FQDN-error.log
</VirtualHost>
+
CustomLog \${APACHE_LOG_DIR}/$FQDN-access.log combined
HERE
+
SSLEngine on
 +
SSLCertificateFile /etc/apache2/$FQDN.crt
 +
SSLCertificateKeyFile /etc/apache2/$FQDN.key
 +
SSLCACertificateFile /etc/apache2/ca.crt
 +
<FilesMatch "\.(cgi|shtml|phtml|php)$">
 +
SSLOptions +StdEnvVars
 +
</FilesMatch>
 +
<Directory /usr/lib/cgi-bin>
 +
SSLOptions +StdEnvVars
 +
</Directory>
 +
</VirtualHost>
 +
</IfModule>
 
</pre>
 
</pre>
 +
 
=Aktivieren=
 
=Aktivieren=
 
*a2ensite $FQDN
 
*a2ensite $FQDN

Version vom 15. August 2021, 17:19 Uhr

Diverse Module aktivieren

  • a2enmod ssl

Cert und Key Dateien plazieren

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

Conf erstellen

FQDN setzen

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

Aktivieren

  • a2ensite $FQDN

Reload

  • systemctl reload apache2
  • cd /etc/apache2/sites-available
  • cat orville.xinux.org.conf

Verlinken und neu starten

  • cd /etc/apache2/sites-enabled
  • ln -s ../sites-available/orville.xinux.org.conf .
  • systemctl restart apache2