Changes between Version 2 and Version 3 of Iam2023/Agenda/SP-Installation-VHosts
- Timestamp:
- Mar 30, 2023, 11:37:29 AM (20 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Iam2023/Agenda/SP-Installation-VHosts
v2 v3 1 1 = Shibboleth SPv3 Installation on Ubuntu 22.04 LTS = 2 2 3 In stallation assumes you have already installed Ubuntu Server 22.04 with default configuration and has a public IP connectivity with DNS setup4 5 == Install Apache and Web applications==6 7 Once logged inyou need to update the Ubuntu package repository.3 In 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 7 First we will install apache web server. Once logged into the system you need to update the Ubuntu package repository. 8 8 9 9 {{{ … … 29 29 = PHP Installation = 30 30 31 Then install PHP and related modules for apache server and MariaDB.31 Then install PHP and related modules required for apache server and MariaDB. 32 32 33 33 {{{ … … 181 181 == Add domains to the hosts file in Linux == 182 182 183 To add domains to the hosts file edit the hosts file as below. Once done save it.183 To 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. 184 184 185 185 {{{ … … 188 188 189 189 127.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. 190 192.248.6.X wp.YOUR-DOMAIN 191 192.248.6.X lms.YOUR-DOMAIN 192 193 }}} 194 195 Now you should be able to access the virtual hosts by their domain names from your host computer. 198 196 199 197 To check it you can ping to the domain or browse from the web browser. 200 198 201 199 {{{ 202 ping wp. your_domain.com203 ping xy.your_2nd_domain.com200 ping wp.YOUR-DOMAIN 201 ping lms.YOUR-DOMAIN 204 202 }}} 205 203 … … 207 205 == Apache Virtual Host Configuration == 208 206 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 }}} 207 First 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 209 For Moodle, 210 sudo mkdir -p /var/www/lms.YOUR-DOMAIN/public_html 211 212 For Wordpress, 213 sudo mkdir -p /var/www/wp.YOUR-DOMAIN/public_html 214 215 216 Then add relevant apache configuration file for Moodle as below. 217 218 {{{ 219 sudo nano /etc/apache2/sites-available/lms.YOUR-DOMAIN.conf 220 }}} 221 222 And add the content below. 218 223 219 224 {{{ 220 225 <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 232 233 </VirtualHost> 233 234 }}} 234 235 236 Next add relevant apache configuration file for Wordpress as well. 237 238 {{{ 239 sudo 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 235 252 Once we do the configurations we have to enable the created sites as below, 236 253 237 254 {{{ 238 sudo a2ensite lms.your_domain.com 255 sudo a2ensite lms.YOUR-DOMAIN 256 sudo a2ensite wp.YOUR-DOMAIN 239 257 }}} 240 258 … … 249 267 }}} 250 268 251 Now we are done with configurations of apache virtual hosting.269 Now 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. 252 270 253 271 … … 286 304 <VirtualHost *:443> 287 305 288 ServerName lms. dhammikalalantha.com289 ServerAdmin you@ yourwebsite.com290 DocumentRoot /var/www/lms. dhammikalalantha.com/public_html306 ServerName lms.YOUR-DOMAIN 307 ServerAdmin you@YOUR-DOMAIN 308 DocumentRoot /var/www/lms.YOUR-DOMAIN/public_html 291 309 292 310 ErrorLog ${APACHE_LOG_DIR}/lms-error.log … … 298 316 299 317 RewriteEngine on 300 RewriteCond %{SERVER_NAME} =lms. dhammikalalantha.com318 RewriteCond %{SERVER_NAME} =lms.YOUR-DOMAIN 301 319 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] # port 80 -- > 443 redirection 302 320 </VirtualHost> … … 380 398 {{{ 381 399 382 /usr/sbin/shib-keygen -n sp-signing -e https://sp.YOUR-DOMAIN/shibboleth383 /usr/sbin/shib-keygen -n sp-encrypt -e https://sp.YOUR-DOMAIN/shibboleth400 /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 384 402 shibd -t /etc/shibboleth/shibboleth2.xml (Check Shibboleth configuration) 385 403