Exercises for Apache -------------------- Choose a domain name for your website. darna.ittc.up.edu.ph # example a) add to /etc/hosts # for lab/experiment a) add to DNS 1. Change the port number of your Apache server to 8080 a) edit /etc/apache2/ports.conf Edit the NameVirtualHost *:80 line to reflect the new port number Edit the Listen 80 line to reflect the new port number 2. Make the Document Root directory /var/www/domainname a) create the directory mkdir /var/www/domainname b) edit /etc/apache2/sites-available/domainname you can create the file from scratch or copy default to domainname then modify ServerName darna.ittc.up.edu.ph DocumentRoot /var/www/darna.ittc.up.edu.ph c) enable the site $ sudo a2ensite darna.ittc.up.edu.ph # create a symlink to the new config file 3. Create a basic HTML file and place it in /var/www/domainname 4. Restart your Apache server 5. Using telnet, connect to localhost port 8080 then type: GET / What do you get? 6. Set StartServer to 15 in the config file. Then restart apache. How do you determine how many servers are running? We'll do name based and IP based virtual hosting later. [TIP: Try to teach/help your classmates with the exercises. This helps you cement/concretize the topics that you know when you teach others about it.] 7. Enable PHP in Apache. $ sudo apt-get install php5 # install the php5 package $ sudo a2enmod php5 # optional, install usually enables our index.php contains the following lines: 8. Optional: Create several domains Experiment with configuring IP based Virtual Hosts Make sure you understand the difference between this and Name Based Virtual Hosts.