Skip to main content

Apache HTTP Server 2.4.x Installation and Configuration

Apache HTTP Server 2.4.x Installation and Configuration | By A.M.Rinas

Apache2 installation tutorial by A.M. Rinas | AM Rinas | Rinas AM

Aim:

Install Apache HTTP Server 2.4.x using the binary distribution and configure it for various purposes.

Installation Steps

Step 1: Download and Extract Apache HTTP Server

  • Download the Apache HTTP Server 2.4.x binary distribution from the official website.
  • Extract the downloaded tarball:
    tar xvf httpd-2.4.x.tar.gz

Step 2: Configure and Install Apache HTTP Server

  • Navigate to the extracted directory:
    cd httpd-2.4.x
  • Configure Apache with necessary modules and options:
    ./configure --enable-proxy --enable-proxy-http --enable-ssl --enable-rewrite
  • Compile and install Apache:
    make
    sudo make install

Step 3: Configure Forward Proxy

  • Edit Apache configuration file to enable forward proxy:
    sudo nano /usr/local/apache2/conf/httpd.conf
  • Add the following lines:
    ProxyRequests On
    ProxyVia On
    ProxyTimeout 300

Step 4: Configure Reverse Proxy to Apache Tomcat

  • Edit Apache configuration file:
    sudo nano /usr/local/apache2/conf/httpd.conf
  • Add the following lines for reverse proxy to Apache Tomcat:
    ProxyPass "/tomcat/" "http://localhost:8080/"
    ProxyPassReverse "/tomcat/" "http://localhost:8080/"

Step 5: Configure Virtual Host

  • Edit Apache configuration file:
    sudo nano /usr/local/apache2/conf/httpd.conf
  • Add virtual host configuration:
    <VirtualHost *:80>
            ServerName example.com
            DocumentRoot /path/to/document/root
        </VirtualHost>

Step 6: Configure Rewrite Rules

  • Edit Apache configuration file:
    sudo nano /usr/local/apache2/conf/httpd.conf
  • Add rewrite rules as needed:
    RewriteEngine On
    RewriteRule ^/old-path$ /new-path [R,L]

Step 7: Enable SSL

  • Generate SSL certificate and key (if not already generated).
  • Edit Apache configuration file:
    sudo nano /usr/local/apache2/conf/httpd.conf
  • Add SSL configurations:
    SSLEngine On
    SSLCertificateFile /path/to/certificate.crt
    SSLCertificateKeyFile /path/to/private-key.key

Verification:

Verify the Apache configuration and restart the server:

sudo /usr/local/apache2/bin/apachectl configtest
sudo /usr/local/apache2/bin/apachectl restart

To start the server in the installed folder, open the terminal and type:

/usr/local/apache2/bin/apachectl -k start

Written by: A.M.Rinas

Contact: mohomadrinas00@gmail.com

Comments

Popular posts from this blog

Use Katalon Studio in ubuntu

How to Install and Use Katalon Studio for Web Testing Step-by-Step Guide to Installing Katalon Studio Katalon Studio is a powerful tool for automating web, API, and mobile testing. In this guide, we'll walk you through the installation process and show you how to create your first test case for a web application. Step 1: Download Katalon Studio Start by downloading the latest version of Katalon Studio from the official website. Choose the version that suits your operating system. Step 2: Extract and Run the Application Once the download is complete, extract the contents of the downloaded file. Inside the extracted folder, locate the katalon.sh file (for Linux users) and run it to launch Katalon Studio: ./katalon If you're on Windows...

Grafana Installation on Ubuntu using Docker

Grafana Installation on Ubuntu using Docker Aim : Install Grafana OSS (open-source version) on Ubuntu using Docker. Grafana Installation Steps Step 1: Pull and Run the Grafana Container Pull and start the Grafana container: sudo docker run -d -p 3000:3000 --name=grafana grafana/grafana-oss -d : Detaches the container and runs it in the background. -p 3000:3000 : Maps port 3000 on your host machine to port 3000 inside the container, enabling access to Grafana's web interface. --name=grafana : Specifies the name of the container as grafana . Step 2: Access Grafana Once the container is running, access Grafana by opening a web browser and navigating to: http://localhost:3000 If Grafana is running on a remote serv...

MySQL 8.0 Binary Installation: A Step-by-Step Guide

MySQL 8.0 Installation: A Comprehensive Guide Aim : Install MySQL 8.0 using the binary distribution on a Linux system. MySQL 8.0 Installation Steps Step 1: Prepare System and User Create a MySQL group: groupadd mysql Create a MySQL user with restricted shell access: useradd -r -g mysql -s /bin/false mysql Step 2: Download and Extract MySQL Navigate to the installation directory(Not compulsory): cd /usr/local Extract the MySQL tarball: tar xvf /path/to/mysql-VERSION-OS.tar.xz Create a symbolic link: ln -s full-path-to-mysql-VERSION-OS mysql Navigate to the MySQL directory: cd mysql Create a directory for MySQL files: mkdir mysql-files Set ownership and permissio...