Changes between Version 2 and Version 3 of Iam2023/Agenda/SP-Installation-VHosts


Ignore:
Timestamp:
Mar 30, 2023, 11:37:29 AM (20 months ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Iam2023/Agenda/SP-Installation-VHosts

    v2 v3  
    11= Shibboleth SPv3 Installation on Ubuntu 22.04 LTS =
    22
    3 Installation assumes you have already installed Ubuntu Server 22.04 with default configuration and has a public IP connectivity with DNS setup
    4 
    5 == Install Apache and Web applications ==
    6 
    7 Once logged in you need to update the Ubuntu package repository.
     3In this lab we are going to enable shibboleth login for Moodle and Wordpress web applications. Installation assumes you have already installed Ubuntu Server 22.04 with default configuration and has a public IP connectivity.
     4
     5== Install Apache Web Server ==
     6
     7First we will install apache web server. Once logged into the system you need to update the Ubuntu package repository.
    88
    99{{{
     
    2929= PHP Installation =
    3030
    31 Then install PHP and related modules for apache server and MariaDB.
     31Then install PHP and related modules required for apache server and MariaDB.
    3232
    3333{{{
     
    181181== Add domains to the hosts file in Linux ==
    182182
    183 To add domains to the hosts file edit the hosts file as below. Once done save it.
     183To add domains to the hosts file edit the hosts file as below. Please make sure to replace YOUR-DOMAIN with your own domain like 'instxx.ac.lk'. Once done save it.
    184184
    185185{{{
     
    188188
    189189127.0.0.1 localhost
    190 127.0.1.1 web
    191 10.1.1.240 web.your_domain.com
    192 10.1.1.240 wp.your_domain.com
    193 10.1.1.240 lms.your_domain.com
    194 10.1.1.240 xy.your_2nd_domain.com
    195 }}}
    196 
    197 Now you should be able to access the virtual hosts by their domain names within the computer.
     190192.248.6.X wp.YOUR-DOMAIN
     191192.248.6.X lms.YOUR-DOMAIN
     192
     193}}}
     194
     195Now you should be able to access the virtual hosts by their domain names from your host computer.
    198196
    199197To check it you can ping to the domain or browse from the web browser.
    200198
    201199{{{
    202 ping wp.your_domain.com
    203 ping xy.your_2nd_domain.com
     200ping wp.YOUR-DOMAIN
     201ping lms.YOUR-DOMAIN
    204202}}}
    205203
     
    207205== Apache Virtual Host Configuration ==
    208206
    209 First we are going to install Moodle LMS and enable Shibboleth login for that. now let's make a directory for hosting Moodle web site.
    210 
    211 sudo mkdir -p /var/www/lms.your_domain.com/public_html
    212 
    213 We are going to host a moodle site too. Add a configuration file as below.
    214 
    215 {{{
    216 sudo nano /etc/apache2/sites-available/lms.your_domain.com.conf
    217 }}}
     207First we are going to install Moodle LMS and Wordpress CMS applications and enable Shibboleth login for those. now let's make a directories for hosting those web sites.
     208
     209For Moodle,
     210sudo mkdir -p /var/www/lms.YOUR-DOMAIN/public_html
     211
     212For Wordpress,
     213sudo mkdir -p /var/www/wp.YOUR-DOMAIN/public_html
     214
     215
     216Then add relevant apache configuration file for Moodle as below.
     217
     218{{{
     219sudo nano /etc/apache2/sites-available/lms.YOUR-DOMAIN.conf
     220}}}
     221
     222And add the content below.
    218223
    219224{{{
    220225<VirtualHost *:80>
    221     ServerName lms.your_domain.com
    222     ServerAlias lms.your_domain.com
    223     ServerAdmin webmaster@lms.your_domain.com
    224     DocumentRoot /var/www/lms.your_domain.com/public_html
    225 
    226     <Directory /var/www/lms.your_domain.com/public_html>
    227         Options -Indexes +FollowSymLinks
    228     </Directory>
    229 
    230     ErrorLog ${APACHE_LOG_DIR}/lms.your_domain.com-error.log
    231     CustomLog ${APACHE_LOG_DIR}/lms.your_domain.com-access.log combined
     226    ServerName lms.YOUR-DOMAIN
     227    ServerAlias lms.YOUR-DOMAIN
     228    ServerAdmin webmaster@lms.YOUR-DOMAIN
     229    DocumentRoot /var/www/lms.YOUR-DOMAIN/public_html
     230
     231    ErrorLog ${APACHE_LOG_DIR}/lms.YOUR-DOMAIN-error.log
     232    CustomLog ${APACHE_LOG_DIR}/lms.YOUR-DOMAIN-access.log combined
    232233</VirtualHost>
    233234}}}
    234235
     236Next add relevant apache configuration file for Wordpress as well.
     237
     238{{{
     239sudo nano /etc/apache2/sites-available/wp.YOUR-DOMAIN.conf
     240}}}
     241
     242<VirtualHost *:80>
     243    ServerName wp.YOUR-DOMAIN
     244    ServerAlias wp.YOUR-DOMAIN
     245    ServerAdmin webmaster@wp.YOUR-DOMAIN
     246    DocumentRoot /var/www/wp.YOUR-DOMAIN/public_html
     247
     248    ErrorLog ${APACHE_LOG_DIR}/wp.YOUR-DOMAIN-error.log
     249    CustomLog ${APACHE_LOG_DIR}/wp.YOUR-DOMAIN-access.log combined
     250</VirtualHost>
     251
    235252Once we do the configurations we have to enable the created sites as below,
    236253
    237254{{{
    238 sudo a2ensite lms.your_domain.com
     255sudo a2ensite lms.YOUR-DOMAIN
     256sudo a2ensite wp.YOUR-DOMAIN
    239257}}}
    240258
     
    249267}}}
    250268
    251 Now we are done with configurations of apache virtual hosting.
     269Now we should be able to enter above URLs on the browser to check whether they are working. You may get empty web pages since we haven't yet installed our web sites.
    252270
    253271
     
    286304        <VirtualHost *:443>
    287305
    288                 ServerName lms.dhammikalalantha.com
    289                 ServerAdmin you@yourwebsite.com
    290                 DocumentRoot /var/www/lms.dhammikalalantha.com/public_html
     306                ServerName lms.YOUR-DOMAIN
     307                ServerAdmin you@YOUR-DOMAIN
     308                DocumentRoot /var/www/lms.YOUR-DOMAIN/public_html
    291309
    292310                ErrorLog ${APACHE_LOG_DIR}/lms-error.log
     
    298316
    299317                RewriteEngine on
    300                 RewriteCond %{SERVER_NAME} =lms.dhammikalalantha.com
     318                RewriteCond %{SERVER_NAME} =lms.YOUR-DOMAIN
    301319                 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] # port 80 -- > 443 redirection
    302320        </VirtualHost>
     
    380398{{{
    381399
    382     /usr/sbin/shib-keygen -n sp-signing -e https://sp.YOUR-DOMAIN/shibboleth
    383     /usr/sbin/shib-keygen -n sp-encrypt -e https://sp.YOUR-DOMAIN/shibboleth
     400    /usr/sbin/shib-keygen -n lms-signing -e https://lms.YOUR-DOMAIN/shibboleth
     401    /usr/sbin/shib-keygen -n lms-encrypt -e https://lms.YOUR-DOMAIN/shibboleth
    384402    shibd -t /etc/shibboleth/shibboleth2.xml (Check Shibboleth configuration)
    385403