Solved

Running Apache with Multiple httpd.conf files - Linux.

Posted on 2008-06-24
5
1,453 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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…
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.

688 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