Solved

apache config question

Posted on 2006-07-13
12
573 Views
Last Modified: 2013-12-16
Hi,

Got an Ubuntu server, DHCP, running Apache2
Want to setup multiple virtual hosts e.g.

NameVirtualHost *:80
<VirtualHost *:80>
      ServerAdmin webmaster@localhost
      ServerName XYZ
      

NameVirtualHost *:82
<VirtualHost *:82>
      ServerAdmin webmaster@localhost
      ServerName XYZ

Purely an internal network, no common DNS within the network
On the server itself, /etc/hosts has 127.0.0.1 XYZ

When restart Apache, get

"apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName"

How can I configure all of this so that I don't get this error?
On the server itself I can ping "XYZ"

Thanks, Ben

0
Comment
Question by:bcops
12 Comments
 
LVL 39

Expert Comment

by:noci
ID: 17104305
FQDN (Fully Quali...) is a hostname with domain name appended i.e.

you have server xyz in exmaple.com then the FQDN is XYZ.example.com
Find the line with ServerName in your apache config file and set the right name there.

This servername has nothing to do with the virtualHosts you created.
0
 
LVL 22

Assisted Solution

by:pjedmond
pjedmond earned 50 total points
ID: 17104692
You need something like the following in your /etc/hosts:

--------x8-----------
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain   localhost
192.168.1.100   bigserver bigserver.mysite.com
--------x8-----------
(   (()
(`-' _\
 ''  ''
0
 
LVL 24

Expert Comment

by:slyong
ID: 17104694
Hi Ben,

Look for the ServerName directive in your httpd.conf file.  Change the ServerName to something like xyz.yourdomain.com and also add that into your /etc/hosts file
127.0.0.1 xyz xyz.yourdomain.com

0
 

Author Comment

by:bcops
ID: 17106756
Hi all,

RE: pjedmonds answer - v helpful by the way:

--------x8-----------
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain   localhost
192.168.1.100   bigserver bigserver.mysite.com
--------x8-----------

The second line that has the IP address - problem I have is that the server does not have a fixed IP, and ideally I'd like it if it didn't - if it remained with a DHCP'd address.

Could I not alter it so that it ended up like this:

--------x8-----------
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain   localhost
127.0.0.1       bigserver bigserver.mysite.com
--------x8-----------

??

Thanks, Ben











0
 
LVL 24

Accepted Solution

by:
slyong earned 300 total points
ID: 17106765
You can do it like this:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       bigserver bigserver.mysite.com   localhost.localdomain   localhost
0
 
LVL 24

Expert Comment

by:slyong
ID: 17106768
Also you have to change your httpd.conf with the line:

ServerName  bigserver.mysite.com

if you search through the httpd.conf file you should see the ServerName directive.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:bcops
ID: 17106872
Ok, great.
And the bigserver.mysite.com can be completely made up? Remember it's an internal only server.

Thanks.

0
 
LVL 24

Expert Comment

by:slyong
ID: 17106892
Hi Ben,

Yes it can be just made up.
0
 

Author Comment

by:bcops
ID: 17106961
Great, many thanks. I'll try it this w/e, and let all know how I get on.
Thanks to one and all.

0
 

Author Comment

by:bcops
ID: 17115581
OK, thanks - that appears to have fixed the ServerName issue. I'm now left with:

[Sat Jul 15 21:37:43 2006] [error] VirtualHost *:82 -- mixing * ports and non-* ports with a NameVirtua lHost address is not supported, proceeding with undefined results
[Sat Jul 15 21:37:43 2006] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtua lHost address is not supported, proceeding with undefined results
[Sat Jul 15 21:37:43 2006] [warn] NameVirtualHost *:82 has no VirtualHosts
[Sat Jul 15 21:37:43 2006] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Jul 15 21:37:44 2006] [error] VirtualHost *:82 -- mixing * ports and non-* ports with a NameVirtua lHost address is not supported, proceeding with undefined results
[Sat Jul 15 21:37:44 2006] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtua lHost address is not supported, proceeding with undefined results
[Sat Jul 15 21:37:44 2006] [warn] NameVirtualHost *:82 has no VirtualHosts
[Sat Jul 15 21:37:44 2006] [warn] NameVirtualHost *:80 has no VirtualHosts

which completely baffles me. I'm using a 000-default file in /etc/apache2/sites-enabled that I've used before with Apache2 & Ubuntu before.

Perplexed.

0
 
LVL 24

Expert Comment

by:slyong
ID: 17115621
Hi Ben,

It appears that you are mixing NameVirtualHost with VirtualHost *.  They cannot be used together.  If you want to use port 80 and 82 as different VirtualHost, try to comment out all the NameVirtualHost entries.  If you are not sure, you can put up your httpd.conf file here and the experts will troubleshoot for you.
0
 

Author Comment

by:bcops
ID: 17115672

OK, seem to have sorted it. I'm using Ubuntu, and on Debian/Ubuntu the httpd.conf file is split into many small files in various different locations.

The main chunk where you define VirtualHosts is in /etc/apache2/sites-available/default. HOWEVER - there is also a symbolic link from /etc/apache2/sites-enabled/000-default to that same file. I was editing the 000-default file rather than the sites-available/default file.

When I started to edit the  sites-available/default file directly, all seemed to work file.

Wierd.

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

708 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

13 Experts available now in Live!

Get 1:1 Help Now