Run a second instance of httpd on an alternate port

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search

These steps will work from a stock LinkStation Pro running Apache version 1.3. The only modifications needed are to enable telnet and root access. You will need to be able to edit text files and scripts. I used vi that was built into the firmware.


Create a symbolic link for httpd2 (the new server)

ln –s /usr/local/apache/bin/httpd /usr/local/apache/bin/httpd2


Create new .conf and .pid files for your new server

cp /etc/apache/httpd.conf /etc/apache/httpd2.conf

cp /var/run/apache/httpd.pid /var/run/apache/httpd2.pid


Edit your httpd2.conf file for your new server

Change PidFile to /var/run/apache/httpd2.pid

Change Port to 81 or 8080 or whatever port you want this instance to use.

Change ServerName to your hostname

Change DocumentRoot to your new www directory

Change the second <Directory> directive to your new www directory

Comment out the aliases added by buffalo in the <IfModule mod_alias.c> directive. Change the ScriptAlias directive to point to your new cgi-bin directory if you have one.

Everything else can stay as is…


Now you need to get your new server launched. Apache included a nifty script: apachectl start|stop|restart, that will do this for you.

cp /usr/local/apache/bin/apachectl /usr/local/apache/bin/apachectl2

Edit the path of PIDFILE to point to httpd2.pid

Edit the path of HTTPD to "/usr/local/apache/bin/httpd2 -f /etc/apache/httpd2.conf"

You can leave the rest alone, or you can change the echo commands below to output “httpd2” instead of httpd.

Run /usr/local/apache/bin/apachectl2 start, and now your server will be started.


To get your new server to begin at boot:

sed -e "s@httpd@httpd2@" “@apachectl@apachectl2@” /etc/init.d/httpd.sh > /etc/init.d/httpd2.sh

add httpd2.sh to Step 3 of /etc/init.d/rcS

Link.png This article is currently a stub. You can help this Wiki by expanding it

. This template will categorize articles that include it into Category:Stubs.