• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Configure Apache as Reverse Proxy (Ubuntu, Cloud Server)

By Abhishek Ghosh February 10, 2017 8:01 am Updated on February 10, 2017

How to Configure Apache as Reverse Proxy (Ubuntu, Cloud Server)

Advertisement

Normally these days we use Nginx as reverse proxy. Like, in an old guide we have shown how to use Nginx reverse proxy to add an IPv6 address to IPv4 only dedicated server. Also we provided configuration of such for HSTS website. We actually can use Apache web server as reverse proxy. Here is How to Configure Apache as Reverse Proxy on Single Cloud Server Instance Running Ubuntu 16.04 For IPv4. We will use some cloud server like VPSDime $7 per month 6 GB OpenVZ instance for this work. For very small need, we can use 1GB RAM at 1 Euro Per Month Aruba Cloud VMWare instance. We will set up Apache as a basic reverse proxy using the mod_proxy extension to redirect the incoming connections to one or several backend servers.

How to Configure Apache as Reverse Proxy Ubuntu, Cloud Server

 

Required Modules to Configure Apache as Reverse Proxy

 

The modules that are needed to use Apache as a reverse proxy includes :

  1. mod_proxy : the core proxy module Apache module for redirecting connections
  2. mod_proxy_http : adds support for proxying HTTP and HTTPS connections.
  3. mod_proxy_balancer : adds load balancing features.
  4. mod_lbmethod_byrequests : adds load balancing features.
  5. mod_proxy_ftp : This handles fetching documents with FTP.
  6. mod_proxy_connect : This handles the CONNECT method for secure tunnelling.
  7. mod_proxy_ajp : This handles the AJP protocol for Tomcat like backend servers.
  8. mod_proxy_html:  This rewrites HTML links into a proxy’s address space.
  9. mod_xml2enc : This supports internationalisation behalf of mod_proxy_html.
  10. mod_headers: This modifies HTTP request and response headers.
  11. mod_deflate: Negotiates compression with clients and backends.
  12. mod_cache : To enable caching.
  13. mod_disk_cache : To enable caching.
  14. mod_mem_cache : To enable caching.

 

How to Configure Apache as Reverse Proxy

 

First update and upgrade :

Advertisement

---

Vim
1
apt update -y

Vim
1
apt upgrade -y

Now, we will install Apache on our server :

Vim
1
apt install apache2 -y

Once Apache has been installed, we need to start the Apache service, configure it to start automatically restart on reboot. Open :

Vim
1
2
sudo /etc/init.d/apache2 start
sudo update-rc.d apache2 defaults

We have to install mod_proxy and dependencies :

Vim
1
apt install libapache2-mod-proxy-html libxml2-dev build-essential -y

Run the below command to get the list of available modules:

Vim
1
sudo a2enmod

We need to run commands to enable the modules we need, one by one :

Vim
1
2
3
4
5
6
7
8
9
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
sudo a2enmod proxy_html

Apache default configuration file is usually 000-default.conf, we can create our own virtual host file at /etc/apache2/sites-available location :

Vim
1
2
3
sudo a2dissite 000-default
touch /etc/apache2/sites-available/proxy-http
nano /etc/apache2/sites-available/proxy-http

Now, add something like this on that /etc/apache2/sites-available/proxy-http file :

/etc/apache2/sites-available/proxy-http
Vim
1
2
3
4
5
6
7
8
  ServerAdmin admin@example.com
  DocumentRoot /var/www/
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  ProxyPreserveHost On
  ProxyPass / http://server-ip-address:8080/
  ProxyPassReverse / http://server-ip-address:8080/
  ServerName example.com

Save and close the file. Enable new virtual host file:

Vim
1
sudo a2ensite proxy-http

We may also need to direct Apache to listen on port 8080. “May”, as it depends. That can be done by editing the ports.conf file:

Vim
1
nano /etc/apache2/ports.conf

Directive will be :

Vim
1
Listen 8080

If you change, you need to restart :

Vim
1
sudo /etc/init.d/apache2 restart

In the above change of port case, http://i.p.a.d.d.r.e.ss:80 will show the application which is running on http://i.p.a.d.d.r.e.ss:8080. If we want to enable SSL support, then we will need to enable the SSL module first.

Vim
1
2
sudo a2enmod ssl
sudo /etc/init.d/apache2 restart

Next, you will need to use Let’s Encrypt certificate in the way we have shown for Nginx in different guide.
We can copy all the certificate files to the /etc/apache2/ssl directory. We will create new virtual host file named proxy-https :

Vim
1
nano /etc/apache2/sites-available/proxy-https

Here is example config :

Vim
1
2
3
4
5
6
7
8
9
10
11
        ServerAdmin admin@example.com
        DocumentRoot /var/www/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/ca.crt
        SSLCertificateKeyFile /etc/apache2/ssl/ca.key
        ProxyPreserveHost On
        ProxyPass /var/www/ http://server-ip-address:8080/
        ProxyPassReverse /var/www/ http://server-ip-address:8080/
        ServerName example.com

Save and close the file. Enable new virtual host file:

Vim
1
2
sudo a2ensite proxy-https
sudo /etc/init.d/apache2 restart

There is huge documentation on Apache’s site :

Vim
1
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html

We provided quite basic examples on how to configure Apache as reverse proxy, but possibly that is the critical part.

Tagged With apache reverse proxy change acl depends on conf , apache reverse proxy config , apache windows reverse proxy server setup , erse proxy load balance , paperuri:(b5ca0a1b9798d30ebec9e3469928d2a0) , reverse proxy apache on windows , ubuntu apache2 reverse proxy , Обратный прокси

This Article Has Been Shared 127 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Configure Apache as Reverse Proxy (Ubuntu, Cloud Server)

  • Self Hosted WordPress on Cloud Server for Dummies

    Self Hosted WordPress is itself a scary phrase to a non-tech person and add Cloud Server on it. Here is Very Easy Guide to under Self Hosted WordPress.

  • Google AdSense is Considering Tenure : Positive Move for Good Authors

    Google AdSense is Considering Tenure, that means from now onwards, Google AdSense publishers will get a security for long debated account suspended issue.

  • Open Source Hardware : Less Costly Works Best

    Open Source Hardware provides hardware specifications like Open Source Software, which are publicly available,you can buy the smallest parts and build yourself.

  • Open Source Free Health : Health Will Not Be Costly

    Open Source Free Health can make a Glucose Meter of few dollars, a Robotic Surgical unit of few hundred dollars. Overall burden of health is made by the brands.

  • Cloud Computing and Relationship with Service Oriented Architecture

    Cloud Computing and Service Oriented Architecture (SOA) are two complementary concepts that can be used independently or in agreement.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How to Configure Apache as Reverse Proxy (Ubuntu, Cloud Server)," in The Customize Windows, February 10, 2017, February 1, 2023, https://thecustomizewindows.com/2017/02/configure-apache-as-reverse-proxy-ubuntu/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT