Changes between Version 6 and Version 7 of Csle2022/Agenda/databaseandweb


Ignore:
Timestamp:
Nov 16, 2022, 1:35:57 AM (2 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/databaseandweb

    v6 v7  
    11= Apache Web Server Installation =
    2 
    3 === perfSONAR Installation Options ===
    42
    53First update the Ubuntu package repository.
     
    103101web site for domain 3 - /var/www/your_domain_3/public_html
    104102
    105 In our example we hope to create three subdomains called web,sales and lms. So the full domain names will be web.your_domain.com, sales.your_domain.com and lms.your_domain.com respectively.
     103In our example we hope to create three subdomains called web,wp and lms. So the full domain names will be web.your_domain.com, wp.your_domain.com and lms.your_domain.com respectively.
    106104Use these commands, with your own domain names, to create your directories:
    107105
    108106{{{
    109107sudo mkdir -p /var/www/web.your_domain/public_html
    110 sudo mkdir -p /var/www/sales.your_domain/public_html
     108sudo mkdir -p /var/www/wp.your_domain/public_html
    111109sudo mkdir -p /var/www/lms.your_domain/public_html
    112110}}}
    113111
    114 We are going to install moodle under lms subdomain. For other two domains we will create dummy web pages for each.
     112For the web subdomain we will later create dummy a web site with just a single web page. In the wp subdomain we will install wordpress which is a content management system. We are going to install moodle as well under the lms subdomain.
     113
     114Now we are done with creating web site directories. Now we need to do the actual apache server configurations for the virtual hosting.
     115
     116On Ubuntu systems, Apache Virtual Hosts configuration files are located in /etc/apache2/sites-available directory. They can be enabled by creating symbolic links to the /etc/apache2/sites-enabled directory, which Apache read during the startup. Here we need to create a seperate configuration file for each domain/sub-domain as below.
     117
     118{{{
     119sudo nano /etc/apache2/sites-available/web.your_domain.com.conf
     120}}}
     121
     122And add the below configurations,
     123
     124{{{
     125<VirtualHost *:80>
     126    ServerName web.dhammikalalantha.com
     127    ServerAlias web.dhammikalalantha.com
     128    ServerAdmin webmaster@dhammikalalantha.com
     129    DocumentRoot /var/www/web.dhammikalalantha.com/public_html
     130
     131    <Directory /var/www/web.dhammikalalantha.com/public_html>
     132        Options -Indexes +FollowSymLinks
     133        AllowOverride All
     134    </Directory>
     135
     136    ErrorLog ${APACHE_LOG_DIR}/web.dhammikalalantha.com-error.log
     137    CustomLog ${APACHE_LOG_DIR}/web.dhammikalalantha.com-access.log combined
     138</VirtualHost>
     139}}}
     140
     141Similarly do the necessary configurations for the domain sales.
     142
     143{{{
     144sudo nano /etc/apache2/sites-available/sales.your_domain.com.conf
     145}}}
     146
     147{{{
     148<VirtualHost *:80>
     149    ServerName sales.dhammikalalantha.com
     150    ServerAlias sales.dhammikalalantha.com
     151    ServerAdmin webmaster@sales.dhammikalalantha.com
     152    DocumentRoot /var/www/sales.dhammikalalantha.com/public_html
     153
     154    <Directory /var/www/sales.dhammikalalantha.com/public_html>
     155        Options -Indexes +FollowSymLinks
     156        AllowOverride All
     157    </Directory>
     158
     159    ErrorLog ${APACHE_LOG_DIR}/sales.dhammikalalantha.com-error.log
     160    CustomLog ${APACHE_LOG_DIR}/sales.dhammikalalantha.com-access.log combined
     161</VirtualHost>
     162}}}
     163
     164Once we do the configurations we have to enable the created sites as below,
     165
     166{{{
     167sudo a2ensite web.dhammikalalantha.com
     168sudo a2ensite sales.dhammikalalantha.com
     169}}}
     170
     171Once done, test the configuration for any syntax errors with.
     172{{{
     173sudo apachectl configtest
     174}}}
     175
     176Restart the Apache service for the changes to take effect.
     177{{{
     178sudo systemctl restart apache2
     179}}}
     180
     181Now we are done with configurations of apache virtual hosting.
    115182
    116183{{{
     
    139206}}}
    140207
    141 Now we are done with creating web sites and directories. Now we need to do the actual apache server configurations for the virtual hosting.
    142 
    143 On Ubuntu systems, Apache Virtual Hosts configuration files are located in /etc/apache2/sites-available directory. They can be enabled by creating symbolic links to the /etc/apache2/sites-enabled directory, which Apache read during the startup. Here we need to create a seperate configuration file for each domain/sub-domain as below.
    144 
    145 {{{
    146 sudo nano /etc/apache2/sites-available/web.your_domain.com.conf
    147 }}}
    148 
    149 And add the below configurations,
    150 
    151 {{{
    152 <VirtualHost *:80>
    153     ServerName web.dhammikalalantha.com
    154     ServerAlias web.dhammikalalantha.com
    155     ServerAdmin webmaster@dhammikalalantha.com
    156     DocumentRoot /var/www/web.dhammikalalantha.com/public_html
    157 
    158     <Directory /var/www/web.dhammikalalantha.com/public_html>
    159         Options -Indexes +FollowSymLinks
    160         AllowOverride All
    161     </Directory>
    162 
    163     ErrorLog ${APACHE_LOG_DIR}/web.dhammikalalantha.com-error.log
    164     CustomLog ${APACHE_LOG_DIR}/web.dhammikalalantha.com-access.log combined
    165 </VirtualHost>
    166 }}}
    167 
    168 Similarly do the necessary configurations for the domain sales.
    169 
    170 {{{
    171 sudo nano /etc/apache2/sites-available/sales.your_domain.com.conf
    172 }}}
    173 
    174 {{{
    175 <VirtualHost *:80>
    176     ServerName sales.dhammikalalantha.com
    177     ServerAlias sales.dhammikalalantha.com
    178     ServerAdmin webmaster@sales.dhammikalalantha.com
    179     DocumentRoot /var/www/sales.dhammikalalantha.com/public_html
    180 
    181     <Directory /var/www/sales.dhammikalalantha.com/public_html>
    182         Options -Indexes +FollowSymLinks
    183         AllowOverride All
    184     </Directory>
    185 
    186     ErrorLog ${APACHE_LOG_DIR}/sales.dhammikalalantha.com-error.log
    187     CustomLog ${APACHE_LOG_DIR}/sales.dhammikalalantha.com-access.log combined
    188 </VirtualHost>
    189 }}}
    190 
    191 Once we do the configurations we have to enable the created sites as below,
    192 
    193 {{{
    194 sudo a2ensite web.dhammikalalantha.com
    195 sudo a2ensite sales.dhammikalalantha.com
    196 }}}
    197 
    198 Once done, test the configuration for any syntax errors with.
    199 {{{
    200 sudo apachectl configtest
    201 }}}
    202 
    203 Restart the Apache service for the changes to take effect.
    204 {{{
    205 sudo systemctl restart apache2
    206 }}}
    207 
    208208Now that you have your virtual hosts configured, you can test your setup by going to the domains that you configured in your web browser. Below will be the output for the sites we created.
    209209