| Line 30: |
Line 30: |
| | Basic SSL VirtualHost: | | Basic SSL VirtualHost: |
| | <nowiki><VirtualHost *:80> | | <nowiki><VirtualHost *:80> |
| − | ServerName home.rra.lan
| + | ServerName home.rra.lan |
| − | ServerAdmin webmaster@rra.lan
| + | ServerAdmin webmaster@rra.lan |
| − | DocumentRoot /var/www/home.rra.lan
| + | DocumentRoot /var/www/home.rra.lan |
| − |
| + | |
| − | Redirect permanent / https://home.rra.lan
| + | Redirect permanent / https://home.rra.lan |
| − | ErrorLog ${APACHE_LOG_DIR}/error.log
| + | ErrorLog ${APACHE_LOG_DIR}/error.log |
| − | CustomLog ${APACHE_LOG_DIR}/access.log combined
| + | CustomLog ${APACHE_LOG_DIR}/access.log combined |
| − | </VirtualHost>
| + | </VirtualHost> |
| − | <VirtualHost *:443>
| + | <VirtualHost *:443> |
| − | ServerName home.rra.lan
| + | ServerName home.rra.lan |
| − | ServerAdmin webmaster@rra.lan
| + | ServerAdmin webmaster@rra.lan |
| − | DocumentRoot /var/www/home.rra.lan
| + | DocumentRoot /var/www/home.rra.lan |
| − | ErrorLog ${APACHE_LOG_DIR}/error.log
| + | ErrorLog ${APACHE_LOG_DIR}/error.log |
| − | CustomLog ${APACHE_LOG_DIR}/access.log combined
| + | CustomLog ${APACHE_LOG_DIR}/access.log combined |
| − |
| + | |
| − | SSLEngine on
| + | SSLEngine on |
| − | SSLCertificateKeyFile /etc/ssl/private/home.rra.lan.key
| + | SSLCertificateKeyFile /etc/ssl/private/home.rra.lan.key |
| − | SSLCertificateFile /etc/ssl/certs/home.rra.lan.crt
| + | SSLCertificateFile /etc/ssl/certs/home.rra.lan.crt |
| − | SSLCertificateChainFile /etc/ssl/certs/FreeIPA-CA.crt
| + | SSLCertificateChainFile /etc/ssl/certs/FreeIPA-CA.crt |
| − | </VirtualHost>
| + | </VirtualHost> |
| − | </nowiki>
| + | </nowiki> |
| | | | |
| | ==Redirect HTTP to HTTPS== | | ==Redirect HTTP to HTTPS== |
| | sudo nano /etc/apache2/sites-available/redirect_HTTP_to_HTTPS.conf | | sudo nano /etc/apache2/sites-available/redirect_HTTP_to_HTTPS.conf |
| | <nowiki><VirtualHost *:80> | | <nowiki><VirtualHost *:80> |
| − | RewriteEngine on
| + | RewriteEngine on |
| − | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
| + | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] |
| − | </VirtualHost></nowiki>
| + | </VirtualHost></nowiki> |
| | sudo ln -s /etc/apache2/sites-available/redirect_HTTP_to_HTTPS.conf /etc/apache2/sites-enable/redirect_HTTP_to_HTTPS | | sudo ln -s /etc/apache2/sites-available/redirect_HTTP_to_HTTPS.conf /etc/apache2/sites-enable/redirect_HTTP_to_HTTPS |
| | ==Authentication== | | ==Authentication== |
| Line 66: |
Line 66: |
| | Protect with the directory directive: | | Protect with the directory directive: |
| | <nowiki><Directory "/usr/local/apache/htdocs/secret"> | | <nowiki><Directory "/usr/local/apache/htdocs/secret"> |
| − | AuthType Basic
| + | AuthType Basic |
| − | AuthName "Restricted Files"
| + | AuthName "Restricted Files" |
| − | # (Following line optional)
| + | # (Following line optional) |
| − | AuthBasicProvider file
| + | AuthBasicProvider file |
| − | AuthUserFile "/usr/local/apache/passwd/passwords"
| + | AuthUserFile "/usr/local/apache/passwd/passwords" |
| − | # Require user rbowen
| + | # Require user rbowen |
| − | Require valid-user
| + | Require valid-user |
| − | </Directory></nowiki>
| + | </Directory></nowiki> |
| | | | |
| − | == Reverse Proxy == | + | ==Reverse Proxy== |
| | <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| | a2enmod proxy proxy_http # HTTP | | a2enmod proxy proxy_http # HTTP |
| Line 89: |
Line 89: |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| − | ==== VirtualHost ProxyPass ==== | + | ====VirtualHost ProxyPass==== |
| | <syntaxhighlight lang="apache"> | | <syntaxhighlight lang="apache"> |
| | <VirtualHost *:*> | | <VirtualHost *:*> |
| Line 106: |
Line 106: |
| | </VirtualHost> | | </VirtualHost> |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | + | |
| | + | == apachectl == |
| | + | <syntaxhighlight lang="bash"> |
| | + | sudo apachectl configtest |
| | + | </syntaxhighlight> |
| | + | https://httpd.apache.org/docs/2.4/programs/apachectl.html |
| | | | |
| | | | |