Friday, June 14, 2013

Run Multiple Apache On Single Host 2013

linux is the great invention of is called root of the computing sector.
In this blog post we are going to discuss on how to run two Apache instances on single Linux host.
We already have one Apache installed and serving the static content. The Apache is installed at the following location:
Let`s copy the directory /etc/httpd to /etc/avon_httpd
  cp -pr /etc/httpd  /etc/avon_httpd   
Now, as we have copied the old Apache web-server to a new location /etc/avon_httpd. We need to make the changes to the configuration file.
cd  /etc/avon_httpd and open the httpd.conf file in a vi editor and make changes to the following values:
ServerRoot “/etc/httpd”  TO ServerRoot “/etc/avon_httpd”
Listen 80 TO Listen 82
PidFile run/ TO PidFile run/
Save and close the file.
In the next step we are going to copy the RHEL httpd configuration file.
 cp -pr /etc/sysconfig/httpd  /etc/sysconfig/avon_httpd 
In the next step, let`s copy the script /etc/init.d/httpd  TO /etc/init.d/avon_httpd
 cp -pr  /etc/init.d/httpd   /etc/init.d/avon_httpd 
In this step, Link the /usr/sbin/httpd TO /usr/sbin/avon_httpd
 ln -s  /usr/sbin/httpd   /usr/sbin/avon_httpd 
Open the file avon_httpd under /etc/sysconfig/ and enter the following lines:
OPTIONS="-f /etc/avon_httpd/conf/httpd.conf"
Open the avon_httpd file under /etc/init.d and replace httpd to avon_httpd.
The command used to start/stop httpd and avon_httpd service could be:
  • /etc/init.d/httpd {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}
  • /etc/init.d/avon_httpd {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}