Changes between Version 12 and Version 13 of Csle2022/Agenda/databaseandweb
- Timestamp:
- Nov 22, 2022, 4:10:54 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Csle2022/Agenda/databaseandweb
v12 v13 124 124 {{{ 125 125 <VirtualHost *:80> 126 ServerName web. dhammikalalantha.com127 ServerAlias web. dhammikalalantha.com128 ServerAdmin webmaster@ dhammikalalantha.com129 DocumentRoot /var/www/web. dhammikalalantha.com/public_html130 131 <Directory /var/www/web. dhammikalalantha.com/public_html>126 ServerName web.your_domain.com 127 ServerAlias web.your_domain.com 128 ServerAdmin webmaster@your_domain.com 129 DocumentRoot /var/www/web.your_domain.com/public_html 130 131 <Directory /var/www/web.your_domain.com/public_html> 132 132 Options -Indexes +FollowSymLinks 133 133 </Directory> 134 134 135 ErrorLog ${APACHE_LOG_DIR}/web. dhammikalalantha.com-error.log136 CustomLog ${APACHE_LOG_DIR}/web. dhammikalalantha.com-access.log combined135 ErrorLog ${APACHE_LOG_DIR}/web.your_domain.com-error.log 136 CustomLog ${APACHE_LOG_DIR}/web.your_domain.com-access.log combined 137 137 </VirtualHost> 138 138 }}} … … 146 146 {{{ 147 147 <VirtualHost *:80> 148 ServerName wp. dhammikalalantha.com149 ServerAlias wp. dhammikalalantha.com150 ServerAdmin webmaster@wp. dhammikalalantha.com151 DocumentRoot /var/www/wp. dhammikalalantha.com/public_html152 153 <Directory /var/www/wp. dhammikalalantha.com/public_html>148 ServerName wp.your_domain.com 149 ServerAlias wp.your_domain.com 150 ServerAdmin webmaster@wp.your_domain.com 151 DocumentRoot /var/www/wp.your_domain.com/public_html 152 153 <Directory /var/www/wp.your_domain.com/public_html> 154 154 Options -Indexes +FollowSymLinks 155 155 </Directory> 156 156 157 ErrorLog ${APACHE_LOG_DIR}/wp. dhammikalalantha.com-error.log158 CustomLog ${APACHE_LOG_DIR}/wp. dhammikalalantha.com-access.log combined157 ErrorLog ${APACHE_LOG_DIR}/wp.your_domain.com-error.log 158 CustomLog ${APACHE_LOG_DIR}/wp.your_domain.com-access.log combined 159 159 </VirtualHost> 160 160 }}} … … 168 168 {{{ 169 169 <VirtualHost *:80> 170 ServerName lms. dhammikalalantha.com171 ServerAlias lms. dhammikalalantha.com172 ServerAdmin webmaster@lms. dhammikalalantha.com173 DocumentRoot /var/www/lms. dhammikalalantha.com/public_html174 175 <Directory /var/www/lms. dhammikalalantha.com/public_html>170 ServerName lms.your_domain.com 171 ServerAlias lms.your_domain.com 172 ServerAdmin webmaster@lms.your_domain.com 173 DocumentRoot /var/www/lms.your_domain.com/public_html 174 175 <Directory /var/www/lms.your_domain.com/public_html> 176 176 Options -Indexes +FollowSymLinks 177 177 </Directory> 178 178 179 ErrorLog ${APACHE_LOG_DIR}/lms. dhammikalalantha.com-error.log180 CustomLog ${APACHE_LOG_DIR}/lms. dhammikalalantha.com-access.log combined179 ErrorLog ${APACHE_LOG_DIR}/lms.your_domain.com-error.log 180 CustomLog ${APACHE_LOG_DIR}/lms.your_domain.com-access.log combined 181 181 </VirtualHost> 182 182 }}} … … 185 185 186 186 {{{ 187 sudo a2ensite web. dhammikalalantha.com188 sudo a2ensite wp. dhammikalalantha.com189 sudo a2ensite lms. dhammikalalantha.com187 sudo a2ensite web.your_domain.com 188 sudo a2ensite wp.your_domain.com 189 sudo a2ensite lms.your_domain.com 190 190 }}} 191 191 … … 205 205 206 206 As you know we can't use any preferred domain for our services, websites as we wanted to do. First we have to register them in a relevant domain registry where usually we have to pay. In case you want a ac.lk sub domain you have to get it through LEARN. Once you get your domains registered they are to be assigned IP addresses so that they can be used in your services for hosting services, websites etc. Assigning of IP addresses to the domain names is done through DNS lookup service. This DNS service is also can be accomplished through the relevant domain registry or web hosting service. For the ac.lk domain, LEARN or your institutional network/system administrator will do that for you. 207 208 Receiving domains costs or need the approval from the System Administrator. Hence, for this workshop we can use hosts file in your computer operating system to create any arbitrary domain for your self. Hosts file will override any public DNS but only for your own computer. 209 210 To add domains to the hosts file edit the hosts file as below. 211 212 {{{ 213 nano /etc/hosts 214 215 216 127.0.0.1 localhost 217 127.0.1.1 web 218 192.248.4.70 web.your_domain.com 219 192.248.4.70 wp.your_domain.com 220 192.248.4.70 lms.your_domain.com 221 192.248.4.70 xy.your_2nd_domain.com 222 }}} 223 224 Now you should be able to access the virtual hosts by their domain names within the computer. 225 226 To check it you can ping to the domain or browse from the web browser. 227 228 {{{ 229 ping wp.your_domain.com 230 ping xy.your_2nd_domain.com 231 }}} 207 232 208 233 = Installing Web sites/applications = … … 595 620 Obtaining a new certificate 596 621 Performing the following challenges: 597 http-01 challenge for wp. dhammikalalantha.com622 http-01 challenge for wp.your_domain.com 598 623 Waiting for verification... 599 624 Cleaning up challenges 600 Created an SSL vhost at /etc/apache2/sites-available/wp. dhammikalalantha.com-le-ssl.conf625 Created an SSL vhost at /etc/apache2/sites-available/wp.your_domain.com-le-ssl.conf 601 626 Enabled Apache socache_shmcb module 602 627 Enabled Apache ssl module 603 Deploying Certificate to VirtualHost /etc/apache2/sites-available/wp. dhammikalalantha.com-le-ssl.conf604 Enabling available site: /etc/apache2/sites-available/wp. dhammikalalantha.com-le-ssl.conf628 Deploying Certificate to VirtualHost /etc/apache2/sites-available/wp.your_domain.com-le-ssl.conf 629 Enabling available site: /etc/apache2/sites-available/wp.your_domain.com-le-ssl.conf 605 630 606 631 Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. … … 618 643 619 644 {{{ 620 Redirecting vhost in /etc/apache2/sites-enabled/wp. dhammikalalantha.com.conf to ssl vhost in /etc/apache2/sites-available/wp.dhammikalalantha.com-le-ssl.conf621 622 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 623 Congratulations! You have successfully enabled https://wp. dhammikalalantha.com645 Redirecting vhost in /etc/apache2/sites-enabled/wp.your_domain.com.conf to ssl vhost in /etc/apache2/sites-available/wp.dhammikalalantha.com-le-ssl.conf 646 647 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 648 Congratulations! You have successfully enabled https://wp.your_domain.com 624 649 625 650 You should test your configuration at: 626 https://www.ssllabs.com/ssltest/analyze.html?d=wp. dhammikalalantha.com651 https://www.ssllabs.com/ssltest/analyze.html?d=wp.your_domain.com 627 652 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 628 653 629 654 IMPORTANT NOTES: 630 655 - Congratulations! Your certificate and chain have been saved at: 631 /etc/letsencrypt/live/wp. dhammikalalantha.com/fullchain.pem656 /etc/letsencrypt/live/wp.your_domain.com/fullchain.pem 632 657 Your key file has been saved at: 633 /etc/letsencrypt/live/wp. dhammikalalantha.com/privkey.pem658 /etc/letsencrypt/live/wp.your_domain.com/privkey.pem 634 659 Your cert will expire on 2023-02-20. To obtain a new or tweaked 635 660 version of this certificate in the future, simply run certbot again