Carlos Vargas

Create a Web Server for Testing Purposes

Blog Post created by Carlos Vargas on May 24, 2014

I was working on a project and it required some firewall ports to be opened. The team asked; how can we test the firewall rules are working correctly? There are different ways to test the firewall rules but here is a quick way to test your firewall. A web server with a simple text page. This tutorial will help you install and configure an Ubuntu server with Apache 2.

 

Steps to configure your web server.

 

1. Download the latest version of Ubuntu Server. http://www.ubuntu.com/download/server

2. Follow the installation prompts to install Ubuntu Server.

3. In the packages selections, select  OpenSSH server and LAMP (LAMP means Linux , Apache, MySQL and PHP)

4. After your server reboots, connect to the server via SSH with your favorite client.

5. Edit /etc/apache2/ports.conf add the entry for your web test. Your ports.conf will look similar to this one. Example vi /etc/apache2/ports.conf

ports-conf..png

 

6. Change directory to /etc/apache2/sites-enabled and create a new site for each port you want to test firewall connectivity.  In my example I wanted to test 80, 443 and 8443 so I created one file for each different site. Use your favorite editor to edit the configuration. Example :  vi  001.conf

sites-enable-config.png

<VirtualHost *:443>

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html/443

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

 

7. After you finish with all the files, restart the apache web server: service apache2 restart

restart-apache.png

8. Create an Index file for your different websites.  Example vi /var/www/html/index.html.  Change some of the test for each different page so you can see that you are accessing a different website.

demo-index-html.png

Text For index HTML page.

<html>

                <head>

                                <title></title>

                </head>

                <body>

                                <p>

                                                Demo Page for Testing Port 80</p>

                                <p>

                                                 </p>

                                <p>

                                                Author: Carlos Vargas</p>

                                <p>

                                                HDS Rocks</p>

                </body>

</html>

 

9. Open your favorite Internet browser and navigate to your pages or test your firewall ports

In my example I needed to test port 80, 443, and 8443

 

http://<youripaddress> (this is the default for port 80)

port80.png

 

http://<youripaddress>:443   (this will open the site in port 443)

port443.png

http://<youripaddress>:8443 (this will open your website in port 8443)

port8443.png

 

With this steps you can create multiple websites and test your firewall rules before you put anything in production. If this helps you let me know.

Outcomes