How to setup a Reverse Proxy with Apache Mod_Proxy?

Today, we will see the implementation of Apache as a reverse proxy in the front-end of another apache server that will be its back-end. We will use this module Mod_Proxy and Mod_Proxy_HTTP. We will just try to redirect the flow arriving at a destination server of a domain name to a server located further upstream in the architecture. We will not discuss here the subjects of Load distribution or load balancing that can perform the role of reverse proxy. The system of reverse proxy may here be summarized as follows:

Therefore, there is a first server front-end that receives all requests and multiple web servers’ backend that each contains a different website (or even as part of a load balancing). So we will set up the reverse proxy server to redirect requests according to each URL and the requested content. This can be done by folder (for example, just redirect / image to a specific server) or a full URL, what we see here:

Architecture

To illustrate the implementation of our Apache reverse proxy, here we will follow the below schedule:

So we have a first server with the public IP 10.10.10.21 that will receive all requests from clients. It contains the www.firstdomain.com, then a second server which contains the website www.seconddomain.com.

So we will configure our first server Reverse Proxy so that it redirects requests www.seconddomain.com by second sever, fulfilling its role as reverse proxy. However, it will continue to respond to those requests for www.firstdomain.com, to illustrate this how a normal website using a reverse proxy:

We assumed here that the machines are in place at the OS level, network and have a functional Apache server with a website on each machine meets the good URL.

Installation and Configuration

We will initially activate proxy_http on the reverse proxy server. This is the module mod_proxy specific to the HTTP protocol that we work with here. For this, we entered the below command:

| a2enmod proxy_http

1) The module “proxy” should be activated at the same time:
2) We will then restart apache2 so that the modules are active:

| Service apache2 restart

We will now create two virtual hosts. One that will lead www.firstdomain.com requests to local content and another who has the role of the reverse proxy and direct the requests to the second server www.secondserver.com with a standard configuration.

| touch /etc/apache2/sites-available/firstdomain.com
| touch /etc/apache2/sites-available/seconddomain.com

We will not perform these configurations: here we willingly place only the information that needed to keep the bulk seen in:

Here is the configuration firstdomain.com

< VirtualHost *:80 >
	ServerName www.firstdomain.com
	DocumentRoot /var/www/firstdomain
< /VirtualHost > 

Here is the configuration of seconddomain.com which is the one that will be the reverse proxy:

< VirtualHost *:80 >
	ServerName www.seconddomain.com
	ProxyPreserveHost On
	ProxyRequests On
	ProxyPass / http://10.10.10.23/
	ProxyPassReverse / http://10.10.10.23
< /VirtualHost >

Then we can enable them:

| a2ensite firstdomain.com
| a2ensite seconddomain.com

read more

Posted in Server Management and Troubleshooting | Tagged , , | Comments Off

How to find world writable files in Linux?

Tux

In Linux, a file “world writable” is a file which everyone can write. These files can be used as sensitive by people who did not aim at the base to write data to the system or out of a given directory. The world writable files are more dangerous when they can run by anyone on the system, as they can then make a script. Today, we will see how easily we can locate these files on a Linux system through the command “Find” that is available on the most of Linux systems.

read more

Posted in SSH/RDP | Tagged | Comments Off

Remote Desktop Linux with rdesktop

Today, we will take a look at a bit of connection and communication between Windows machines and Linux machines through the rdesktop (or you can say remote desktop). This tool make it possible to graphical client for Linux (for this tutorial we’ve taken Debian 7) to open a TSE session or Remote Desktop on a client machine or a Windows Server TSE. Here, we will see how simple it is:

Enable Remote Desktop (we are assuming that you are using Windows 8):

read more

Posted in SSH/RDP | Tagged , | Comments Off

Writing Codes in Your WordPress Posts

wordpress-love

While publishing tutorials you might have struggled to add blocks around “Codes” that you wish to share with your audience. Some people use plugins, but with a simple trick you can publish your codes with blocks without installing any plugin.

For an instance you can use following code in your posts; just make sure to use text editor instead of visual editor:

<Pre><PRE STYLE=”font-family:monospace;
font-size:0.95em;
width:90%;
border:red 2px solid;
color:white;
background-color:#000000; “>
bodHOST Bandwidth on Demand
</PRE><Pre>

read more

Posted in WordPress | Tagged | Comments Off

Increase swap file partition on eNlight (or plane Linux Server)

enlight-cloud-hosting

While increasing Swap File on the Server, first you need to check there should be enough free space (larger than new swap size) available on the partition.

Follow the below steps:

Step 1:- #dd if=/dev/zero of=/swapfile bs=1024 count=1572864

This command is for creating the free space for file /swapfile to 1.5 GB

Please note that count is the block size calculated as (1024 * 1.5)

Step 2:- #mkswap /swapfile

Step 3:- #chown root:root /swapfile

Step 4:- #chmod 0600 /swapfile1

Step 5:- #swapon /swapfile1

Step 6:- #vi /etc/fstab

Enter this at the end of file "/swapfile1 swap swap defaults 0 0"

Step 7:- # mount -a or

Step 8:- free -m (check swap file size for your confirmation)

Step 9:- This has been done Cheers !!!

read more

Posted in FAQ | Tagged , | Comments Off