Friday, June 7, 2013
12:14 PM

Run Multiple Apache On Single Host

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:
/etc/httpd
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/httpd.pid TO PidFile run/avon_httpd.pid
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:
## CUSTOM SETTINGS ##
HTTPD=/usr/sbin/avon_httpd
OPTIONS="-f /etc/avon_httpd/conf/httpd.conf"
LOCKFILE=/var/lock/subsys/avon_httpd
PIDFILE=/var/run/avon_httpd.pid
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}


0 comments:

Post a Comment