Solved

Running Apache with Multiple httpd.conf files - Linux.

Posted on 2008-06-24
5
1,436 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
ID: 21854218
Are you sure that you have setup the Listen statement correctly on the first .conf file
0
 

Author Comment

by:STFCTECHIT
ID: 21854283
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
ID: 21854351
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
ID: 21854417
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
ID: 21854425
Thanks PowerToaster for the advice on preferred configuration setups. I will implement this.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

947 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

25 Experts available now in Live!

Get 1:1 Help Now