Solved

apache config question

Posted on 2006-07-13
12
576 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 40

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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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
 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mcrypt_create_iv() is deprecated 4 274
Like to learn Linux, need advice for a good book and setup. 3 55
LINUX backups with VEEAM 8 115
ifconfig 4 69
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
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…
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.:
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…

791 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