Solved

Running Apache with Multiple httpd.conf files - Linux.

Posted on 2008-06-24
5
1,452 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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 …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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