• 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 » Configure Nginx as a Reverse Proxy for Apache (HP Cloud)

By Abhishek Ghosh June 18, 2015 7:36 pm Updated on June 18, 2015

Configure Nginx as a Reverse Proxy for Apache (HP Cloud)

Advertisement

Here is How To Configure Nginx as a Reverse Proxy for Apache on HP Cloud Instance Running Ubuntu or Any Deb GNU/Linux. Both listen to port 80. We talked about Reverse Proxy and Reverse Proxying with Nginx Before. This is not a fully new users’ guide.

 

Configure Nginx as a Reverse Proxy for Apache : Specific For HP Cloud

 

Router, Subnet settings should be set properly to allow Port 80 Ingress and Egress.

If we run Apache behind Nginx, then the Port will be 8080. This is for who do not want to use PHP via FastCGI i.e. run a separate PHP5-FPM process.

Advertisement

---

If we configure for Side by Side running, we will use Port 80. Side by Side running needed when the web software does not support Nginx. If need to update the NameVirtualHost directive with IP in this case.

 

Configure Nginx as a Reverse Proxy for Apache

 

First we need to install Nginx :

Vim
1
2
apt-get install nginx
# apt-get install nginx-full

First we need edit the /etc/nginx/sites-available/default file :

/etc/nginx/sites-available/default
Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
server {
     listen   80;
# /usr/share/nginx/html;
      root /var/www/;
      server_name thecustomizewindows.com;
        index index.php index.html index.htm;
        server_name thecustomizewindows.com;
      access_log logs/nginx_access.log;
      error_log logs/nginx_error.log;
      location / {
            try_files $uri $uri/ @backend;
      }
      location @backend {
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
            proxy_pass http://127.0.0.1:8080;
#         proxy_pass http://10.0.0.1:8080;
      }
      
      location ~ /\.ht {
                deny all;
        }
}

If Nginx fails then it will pass the request to Apache2. Be careful about the listen 80; directive. Test with commenting it out and running nginx -t.

Configure Nginx as a Reverse Proxy for Apache (HP Cloud)

Now we will install Apache2 :

Vim
1
apt-get install apache2

We have edit two files, one is /etc/apache2/ports.conf :

/etc/apache2/ports.conf
Vim
1
2
NameVirtualHost 127.0.0.1:8080
Listen 127.0.0.1:8080

Second, we have copy the default file, edit the port to 8080 :

Vim
1
2
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/thecustomizewindows
nano /etc/apache2/sites-available/thecustomizewindows

That file should have :

Vim
1
<VirtualHost 127.0.0.1:8080>

Apache2 virtual host should be corrected to have the same web root :

Vim
1
2
3
4
5
<VirtualHost>
      DocumentRoot "/var/www/"
      ServerName thecustomizewindows.com
      ...
</VirtualHost>

Now activate it :

Vim
1
sudo a2ensite thecustomizewindows

thecustomizewindows is just a name used. Then we can install PHP5 and restart the services :

Vim
1
2
3
apt-get install php5
service apache2 restart
service nginx restart

Tagged With how to config nginx as reverse proxy ubuntu , nginx reverse proxy apache centos
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 Configure Nginx as a Reverse Proxy for Apache (HP Cloud)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

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

    Here is How to Configure Apache as Reverse Proxy on Single Cloud Server Instance Running Ubuntu 16.04 For IPv4. We Have Not Tested For IPv6.

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
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