HTTP2 Apache2 Webseite: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
 
(18 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 2: Zeile 2:
 
*a2enmod ssl
 
*a2enmod ssl
 
=Cert und Key Dateien plazieren=
 
=Cert und Key Dateien plazieren=
*FQDN="www.xinux.de"
+
*COMMONNAME="xinux.de"
 +
*cp /home/xinux/cert/*.{key,crt} /etc/apache2
 
*ls  /etc/apache2/*.{key,crt}
 
*ls  /etc/apache2/*.{key,crt}
 
  /etc/apache2/ca.crt   
 
  /etc/apache2/ca.crt   
Zeile 9: Zeile 10:
  
 
=Conf erstellen=
 
=Conf erstellen=
=FQDN setzen=
 
*FQDN=www.xinux.de
 
 
*cd /etc/apache2/sites-available
 
*cd /etc/apache2/sites-available
*cat<<HERE>$FQDN.conf
+
*cat<<HERE>$COMMONNAME.conf
 
<pre>
 
<pre>
<VirtualHost *:80>
+
<IfModule mod_ssl.c>
        ServerName $FQDN
+
<VirtualHost _default_:443>
        ServerAdmin webmaster@localhost
+
                ServerName $COMMONNAME
        DocumentRoot /var/www/html/$FQDN
+
ServerAdmin webmaster@localhost
        ErrorLog \${APACHE_LOG_DIR}/$FQDN-error.log
+
DocumentRoot /var/www/html/$COMMONNAME
        CustomLog \${APACHE_LOG_DIR}/$FQDN-access.log combined
+
ErrorLog \${APACHE_LOG_DIR}/$COMMONNAME-error.log
</VirtualHost>
+
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
 
HERE
 
</pre>
 
</pre>
 +
 +
=Verzeichnis anlegen=
 +
*mkdir /var/www/html/$COMMONNAME
 +
*cp /var/www/html/index.html /var/www/html/$COMMONNAME
 +
 
=Aktivieren=
 
=Aktivieren=
*a2ensite $FQDN
+
*a2ensite $COMMONNAME
 +
 
 
=Reload=
 
=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
 
*systemctl restart apache2

Aktuelle Version vom 18. Oktober 2023, 12:07 Uhr

Diverse Module aktivieren

  • a2enmod ssl

Cert und Key Dateien plazieren

  • COMMONNAME="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 $COMMONNAME
		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/$COMMONNAME
  • cp /var/www/html/index.html /var/www/html/$COMMONNAME

Aktivieren

  • a2ensite $COMMONNAME

Reload

  • systemctl restart apache2