Skip to content

Web Server Local Hosting

Dracarys edited this page Feb 15, 2024 · 2 revisions

Set up a local environment with AlmaLinux machine as the server with multiple websites, reverse proxy, forward proxy, and load balancing, follow these steps:

Apache Server Setup for multiple website hosting:

1. Install Apache HTTP Server (httpd): sudo dnf install httpd

2. Create Virtual Hosts for Multiple Websites: Create configuration files for each virtual host under /etc/httpd/conf.d/ directory.

  • /etc/httpd/conf.d/site1.conf image

  • /etc/httpd/conf.d/site2.conf image

3. Create directories for website files:

3.1 Make directory under /var/www/html/ directory. sudo mkdir /var/www/site1 sudo mkdir /var/www/site2

3.2 Set permissions sudo chown -R apache:apache /var/www/site1 sudo chown -R apache:apache /var/www/site2

3.3 Create an index.html for both site1 and site2 echo "WELcum to SITE1 bugga" > /var/www/site1/index.html echo "WELcum to SITE2 bugga" > /var/www/site1/index.html

4. Add servers in hosts file image

5.Enable and start Apache modules: sudo systemctl enable httpd sudo systemctl start httpd

6. Verify it using curl image

Apache Server Setup for reverse proxy:

1. Configure Reverse Proxy: Create a virtual host configuration file for proxy image

2. Add rp.local to /etc/hosts image

3. Restart httpd and verify it using curl sudo systemctl start httpd

image

Apache Server Setup for load balancer:

1. Configure Load Balancer

image

<Proxy balancer://mycluster> defines a load balancer named mycluster with two backend members: site1.local and site2.local

2. Add rp.local to /etc/hosts image

3. Restart httpd and verify it using curl sudo systemctl start httpd

image

Apache Server Setup for forward proxy:

1. Configure forward proxy image

2. Add fp.local to /etc/hosts image

3. Restart httpd and verify it using curl sudo systemctl start httpd image

Nginx Server Setup for multiple website hosting:

1. Install Apache HTTP Server (httpd): sudo dnf install nginx

2. Create Virtual Hosts for Multiple Websites: Create configuration files for each virtual host under /etc/nginx/conf.d/ directory.

  • /etc/nginx/conf.d/site1.conf

  • /etc/httpd/conf.d/site2.conf