Apache Project Assignment Help

Comments Off on Apache Project Assignment Help

Apache Project (10 Marks)

Exercise 1 Setting Up a Basic Web Server

In this exercise, you learn how to set up a basic Apache web server.

Install apache2 package.Open the main Apache configuration file with an editor, and look up the line that starts with Document Root. This identifies the location where the Apache server will look for the contents it will service. Confirm that it is set to /var/www/html.In the directory /var/www/html, create a file with the name index.html. In this file, type “Welcome to my web server”.To start and enable the web server, type systemctl start apache2; systemctl enable apache2. This starts the web server and makes sure that it starts automatically after restarting the server. Use systemctl status apache2 to check that the web server is up and running.Install the elinks text-based browser. Type elinks http://localhost to connect to the web server and verify it is working.

Exercise 2 Configuring Apache Virtual Hosts

In this exercise, you create two virtual hosts. To set up virtual hosts, you first set up name resolution, after which you create the virtual hosts configuration as well.

On both server1 and server2, open the file /etc/hosts with an editor and add two lines that make it possible to resolve the names of the virtual host you are going to create to the IP address of the virtual machine:    server1.example.com          server1    server2.example.com          server2    account.example.com          account     sales.example.com            sales

On server1, create a configuration file with the name account.example.com.conf in the directory /etc/apache2/sites-available. Give this file the following content:

<VirtualHost *:80>

          ServerAdmin webmaster@account.example.com

          DocumentRoot /var/www/account.example.com

          ServerName account.example.com

          ErrorLog ${APACHE_LOG_DIR}/account.example.com-error_log

          CustomLog ${APACHE_LOG_DIR}/account.example.com-access_log common


Close the configuration file and from the root shell use mkdir -p /var/www/account.example.com.

Create a file with the name index.html in the account document root, and make sure its contents read “Welcome to account.” Enable account.example.com.conf web site.Use systemctl restart apache2 to restart the Apache web server. Use elinkshttp://account.example.com. You should now see the account welcome page. (You may have to install elinks, using apt install -y elinks.) Copy the /etc/apache2/sites-available/account.example.com.conf file to a file with the name /etc/apache2/sites-available/sales.example.com.conf. Open the sales.example.com.conf file in vi, and use the vi command :%s/account/sales/g. This should replace all instances of account with the text sales. Create the /var/www/sales.example.com document root, and create a file index.html in it, containing the text “Welcome to the sales server.” Restart Apache2 and verify that the account and the sales servers are both accessible.

Exercise 3 Surviving Advanced Apache Topics

In this exercise, you learn how to use the apache2-doc package. The information is the most accessible when accessed from a graphical environment, but you can also read its contents using a text-based browser, such as elinks.

Install apache2-docpackage.Type systemctl restart apache2, followed by systemctl status apache2.On UbututuDesktop, Start the Firefox browser and enter the URL http://<server1’sip address>/manual.Particularly, take a look at the following how-tos / tutorials:Authentication and Authorization: All you need to know about authenticated access to the webserverCGI: Dynamic Content: More information about working with dynamic contentAlso take a look at the SSL/TLS encryption parts.

Exercise 4 Set up a TLS-secured Apache web server for the virtual host secure.example.com. It should also listen on port 80, but all requests that are directed to port 80 should be forwarded to port 443 immediately.(You may have to modify /etc/hosts file to resolve secure.exmaple.com to an IP address)

To configure Apache for using TLS certificates, three steps must be accomplished:

A certificate must be obtained.The required Apache TLS modules must be installed.The Apache (virtual) host must be configured to use the certificates.

The following procedure describes how these steps are applied to create a certificate for the secure.example.com server:

Enable SSL module in Apache2.Generating a key for the Certificate Signing Request (CSR)

To generate the keys for the Certificate Signing Request (CSR) run the following command from a terminal prompt:

opensslgenrsa -des3 -out server.key 2048

Generating a Certificate Signing Request (CSR)

To create the CSR, run the following command at a terminal prompt:

openssl req -new -key server.key -out server.csr

Creating a Self-Signed Certificate

openssl x509 -req -days 365 -in server.csr -signkeyserver.key -out server.crt

Installing the Certificate

sudo cp server.crt /etc/ssl/certs/secure.example.com.crt

sudo cp server.key /etc/ssl/private/secure.example.com.key

Create virtual host secure.example.com by copying /etc/apache2/sites-available/default-ssl.conf and making virtual host configuration.

cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/secure.example.com-ssl.conf

Redirect port 80 to port 443 (redirect http to https)

create /etc/apache2/sites-available/secure.example.com.conf

<VirtualHost *:80>

ServerName secure.example.com

   Redirect / https://secure.example.com


Make DocumentRoot folder and test the access.

The post Apache Project Assignment Help first appeared on Punjab Assignment Help.

Get 30% off your orders today

WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!