Solved

Running Apache with Multiple httpd.conf files - Linux.

Posted on 2008-06-24
5
1,430 Views
Last Modified: 2013-12-16
Hello,

I am trying to run an Apache2 binary with multiple httpd.conf files. I have a server with two NIC cards, each of which is configured and active.

One httpd.conf is listening on the first NIC address.
The second httpd.conf has the second NIC.
Both httpd.conf files specify the Listen address to the NIC's IP and both try to use port 80.

I am trying to start apache with:-

./apachectl -f /usr/local/apache2/conf/httpd.conf

This is fine. However, when I try to start the second with:-

./apachectl -f /usr/local/apache2/conf/httpd.web-mirror.conf

I get:-

(125)Address already in use: make_sock: could not bind to address 130.246.19.36:80
no listening sockets available, shutting down
Unable to open logs

Can anyone advise me on this ...




0
Comment
Question by:STFCTECHIT
  • 3
5 Comments
 
LVL 19

Assisted Solution

by:http:// thevpn.guru
http:// thevpn.guru earned 25 total points
Comment Utility
Are you sure that you have setup the Listen statement correctly on the first .conf file
0
 

Author Comment

by:STFCTECHIT
Comment Utility
Hi,

The first conf file (httpd.conf) has 192.168.0.1:80
The second conf file has 192.168.0.2:80

Had to change these ip to something generic for public posting but this should not matter...

I have also set the ServerName to the same entry as the listen for each conf file...

Thanks,


Max.



0
 
LVL 2

Accepted Solution

by:
PowerToaster earned 100 total points
Comment Utility
This is not the prefered way of hosting multiple websites with apache, and has a number of draw backs.

All of your global settings (everything that affects all of you webs) should be in the conf/httpd.conf file.
You should then define your webs in the conf.d/ directory.

You can define them in the same or seperate files.
Either way the critical info you need is.

<VirtualHost 130.246.19.36:80>
    ServerAdmin webmaster@mail.smallco.com
    DocumentRoot /groups/smallco/www
    ServerName www.smallco.com
    ErrorLog /groups/smallco/logs/error_log
    TransferLog /groups/smallco/logs/access_log
</VirtualHost>

<VirtualHost 130.246.19.37:80>
    ServerAdmin webmaster@mail.baygroup.org
    DocumentRoot /groups/baygroup/www
    ServerName www.baygroup.org
    ErrorLog /groups/baygroup/logs/error_log
    TransferLog /groups/baygroup/logs/access_log
</VirtualHost>
0
 

Author Comment

by:STFCTECHIT
Comment Utility
Fixed it ...

A combination of problems stemming from various attempts at getting it to work.

I erroneously tried specifying a second PID file. I also forgot to change the <Directory> name to the DocumentRoot.

Both versions are running now and I can access both addresses corresponding to the NIC's from the browser.

Apachectl will only stop once version though .. . That however is another story...
0
 

Author Comment

by:STFCTECHIT
Comment Utility
Thanks PowerToaster for the advice on preferred configuration setups. I will implement this.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now