[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Running Apache with Multiple httpd.conf files - Linux.

Posted on 2008-06-24
5
Medium Priority
?
1,469 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 75 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 300 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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 …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

656 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