0% found this document useful (0 votes)
2 views8 pages

Apache Web Server

Uploaded by

joshsignz77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Apache Web Server

Uploaded by

joshsignz77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Apache Web Server

1. Installation

2. configuration virtual hosts

3. Modules (mod_ssl, mod_rewrite),

4. htaccess, FTP services


1. Install Apache in the Virtual Machine
a) Start the Virtual Machine in VMware Workstation.
b) Update the package lists:
sudo apt update && sudo apt upgrade -y
c) Install Apache:
sudo apt install apache2 -y
d) Start and enable Apache:
sudo systemctl start apache2
sudo systemctl enable apache2
e) Check if Apache is running:
sudo systemctl status apache2
2. Create a Virtual Host Directory

a) Create a new directory for your site:


sudo mkdir -p /var/www/hajarah.com/public_sshtml
b) Set ownership to Apache user (www-data):
sudo chown -R www-data:www-data /var/www/hajarah.com/public_html
c) Set the correct permissions:
sudo chmod -R 755 /var/www
d) Create an index.html file inside the directory:
echo "<h1>Welcome to Example.com</h1>" | sudo tee
/var/www/hajarah.com/public_html/index.html
3. Configure the Virtual Host
1.Create a new virtual host configuration file:
sudo nano /etc/apache2/sites-available/hajarah.com.conf
2.Add the following configuration:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName hajarah.com
ServerAlias www.hajarah.com
DocumentRoot /var/www/hajarah.com/public_html

<Directory /var/www/hajarah.com/public_html>
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
3.Save and exit (CTRL + X, then Y, then ENTER).
4. Enable the Virtual Host

1.Enable the site:


sudo a2ensite hajarah.com.conf
2.Disable the default Apache site (optional):
sudo a2dissite 000-default.conf
3.Restart Apache:
sudo systemctl restart apache2
5. Update Hostname Resolution

Option 1: Edit /etc/hosts (For Local Access)


1.Open the hosts file:
sudo nano /etc/hosts
2.Add this line:
127.0.0.1 hajarah.com
3.Save and exit.
6. Access the Virtual Host

Test from the Host Machine (VMware Workstation Host)


•Open a browser and visit http://hajarah.com.
Troubleshooting Apache

1. Check Apache Configuration for Errors:


sudo apachectl configtest
2. Restart Apache:
sudo systemctl restart apache2
3. Check Logs for Errors:
sudo tail -f /var/log/apache2/error.log

You might also like