| 1 | = Configuring Shibboleth SP on Single server Multi virtual host environment = |
| 2 | |
| 3 | This will guide you through installing Shibboleth Service Provider setup on Ubuntu 20.04 LTS server with Apache2 running as the web server. We will also look into configuring multiple apache virtual hosts and configuring them for SSO login of two different web apps; Wordpress and Moodle. |
| 4 | |
| 5 | |
| 6 | === Requirements === |
| 7 | |
| 8 | * Linux Server running Ubuntu 20.04 LTS |
| 9 | * Apache installed with two different virtual hosts. |
| 10 | * SSL/ HTTPS Certificates issued ( May be using Letsencrypt or Otherwise) |
| 11 | * Installed Wordpress and Moodle latest editions on above created virtual hosts. |
| 12 | |
| 13 | == Apache Config recap == |
| 14 | |
| 15 | === Wordpress Apache Config === |
| 16 | |
| 17 | '''http''' config: {{{ /etc/apache2/sites-enabled/wp.conf }}} |
| 18 | |
| 19 | |
| 20 | {{{ |
| 21 | <VirtualHost *:80> |
| 22 | |
| 23 | ServerName wp.Your-Domain |
| 24 | ServerAdmin you@yourwebsite.com |
| 25 | DocumentRoot /var/www/html #Location of Wordpress installation |
| 26 | |
| 27 | ErrorLog ${APACHE_LOG_DIR}/wp-error.log |
| 28 | CustomLog ${APACHE_LOG_DIR}/wp-access.log combined |
| 29 | |
| 30 | |
| 31 | RewriteEngine on |
| 32 | RewriteCond %{SERVER_NAME} =wp.Your-Domain |
| 33 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] # port 80 -- > 443 redirection |
| 34 | </VirtualHost> |
| 35 | }}} |
| 36 | |
| 37 | |
| 38 | '''https''' config: {{{ /etc/apache2/sites-enabled/wp-le-ssl.conf }}} |
| 39 | |
| 40 | |
| 41 | {{{ |
| 42 | <IfModule mod_ssl.c> |
| 43 | <VirtualHost *:443> |
| 44 | |
| 45 | ServerName wp.Your-Domain |
| 46 | ServerAdmin you@yourwebsite.com |
| 47 | DocumentRoot /var/www/html #Location of Wordpress installation |
| 48 | |
| 49 | ErrorLog ${APACHE_LOG_DIR}/wp-error.log |
| 50 | CustomLog ${APACHE_LOG_DIR}/wp-access.log combined |
| 51 | |
| 52 | #SSL Certificates issued by letsencrypt |
| 53 | SSLCertificateFile /etc/letsencrypt/live/wp.Your-Domain/fullchain.pem |
| 54 | SSLCertificateKeyFile /etc/letsencrypt/live/wp.Your-Domain/privkey.pem |
| 55 | Include /etc/letsencrypt/options-ssl-apache.conf |
| 56 | </VirtualHost> |
| 57 | </IfModule> |
| 58 | }}} |
| 59 | |
| 60 | |
| 61 | === Moodle Apache Config === |
| 62 | |
| 63 | '''http''' config: {{{ /etc/apache2/sites-enabled/mdl.conf }}} |
| 64 | |
| 65 | |
| 66 | {{{ |
| 67 | <VirtualHost *:80> |
| 68 | |
| 69 | ServerName mdl.Your-Domain |
| 70 | ServerAdmin you@yourwebsite.com |
| 71 | DocumentRoot /var/www/mdl #Location of Moodle installation |
| 72 | |
| 73 | ErrorLog ${APACHE_LOG_DIR}/mdl-error.log |
| 74 | CustomLog ${APACHE_LOG_DIR}/mdl-access.log combined |
| 75 | |
| 76 | |
| 77 | RewriteEngine on |
| 78 | RewriteCond %{SERVER_NAME} =mdl.Your-Domain |
| 79 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] # port 80 -- > 443 redirection |
| 80 | </VirtualHost> |
| 81 | }}} |
| 82 | |
| 83 | |
| 84 | '''https''' config: {{{ /etc/apache2/sites-enabled/mdl-le-ssl.conf }}} |
| 85 | |
| 86 | |
| 87 | {{{ |
| 88 | <IfModule mod_ssl.c> |
| 89 | <VirtualHost *:443> |
| 90 | |
| 91 | ServerName mdl.Your-Domain |
| 92 | ServerAdmin you@yourwebsite.com |
| 93 | DocumentRoot /var/www/mdl #Location of Moodle installation |
| 94 | |
| 95 | ErrorLog ${APACHE_LOG_DIR}/mdl-error.log |
| 96 | CustomLog ${APACHE_LOG_DIR}/mdl-access.log combined |
| 97 | |
| 98 | #SSL Certificates issued by letsencrypt |
| 99 | SSLCertificateFile /etc/letsencrypt/live/mdl.Your-Domain/fullchain.pem |
| 100 | SSLCertificateKeyFile /etc/letsencrypt/live/mdl.Your-Domain/privkey.pem |
| 101 | Include /etc/letsencrypt/options-ssl-apache.conf |
| 102 | </VirtualHost> |
| 103 | </IfModule> |
| 104 | }}} |