Skip to content
Menu
myCloud myCloud

Personal short notes about Cloud

  • XMPie
  • AWS
    • AWS Topics
    • AWS Architecture
    • AWS CLI
    • AWS Health
    • AWS Policies
    • AWS Cost
  • CHEAT SHEETS
myCloud myCloud

Personal short notes about Cloud

Reverse proxy Apache

By mikado on October 27, 2022October 31, 2022

1. Install Ubuntu 22.04

  • In AWS console, launch EC2 instance with Ubuntu AMI 22.04 LTS
  • Allocate and associate an Elastic IP to the instance

2. Connect to the EC2 instance

  • SSH via PuTTY (.ppk key)
  • SSH via CLI (.pem key)
    • Use My-Keypair.pem
    • chmod 400 My-Keypair.pem
    • ssh -i “My-Keypair.pem” ubuntu@<ip address>
  • SSH via WinSCP – which use SCP to copy files (.ppk key)
  • Check Ubuntu version
    • hostnamectl

3. Install Apache (apache2 / httpd)

  • Update local package index
sudo apt update
  • Install Apache2 package
sudo apt install apache2

Check version

apache2 -version

  • Upgrade Apache2
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get dist-upgrade
  • apache2 -version
  • Firewall (list ufw app profiles)
sudo ufw app list
  • Disable Firewall
sudo ufw disable
  • Firewall status
sudo ufw status

  • Test web server service & server
sudo systemctl status apache2
  • Get external IP
rl -4 icanhazip.com
  • Browse your server

4. Update the hosts file

/etc/hosts

5. Place the certs

/home/ubuntu/cert

6. Enable Modules

  • enable mod_rewrite
sudo a2enmod rewrite
  • enable mod_ssl
udo a2enmod ssl
  • enable mod_proxy (reverse proxy)
sudo a2enmod proxy
sudo a2enmod proxy_http
  • We will restart apache after the configuration files are set

7. Set configuration files in /etc/apache2

  • In /etc/apache2/sites-available
  • In /etc/apache2/sites-enabled
  • In ports.conf
  • sudo nano /etc/apache2/sites-available/default-ssl.conf
  • sudo nano /etc/apache2/sites-available/000-default.conf
  • Restart apache
sudo systemctl restart apache2
  • Check status
sudo systemctl status apache2
  • Install Datadog agent on production env.

  • To check
/etc/apache2/apache2.conf
sudo apache2ctl configtest

Category: Linux

Categories

  • AWS (4)
  • AWS Architecture (8)
  • AWS CLI (5)
  • AWS Cost (3)
  • AWS Health (4)
  • AWS Policies (2)
  • AWS Topics (24)
  • CHEAT SHEETS (16)
  • Container (21)
  • Datadog (4)
  • Jenkins (2)
  • Linux (9)
  • Microsoft (7)
  • Python (1)
  • SCRIPTS (9)
  • Terraform (5)
  • XMPie (6)
©2025 myCloud
Click to Copy