Deleting virtualhost entries in httpd.conf?

Vatoloco

Well-Known Member
Jun 21, 2004
99
0
166
NameVirtualHost 55.55.555.55:80


<VirtualHost 55.55.555.55>
BytesLog domlogs/cpanel.ev1servers.net-bytes_log
ServerName cpanel.ev1servers.net
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>


NameVirtualHost 55.55.555.55:80


<VirtualHost 55.55.555.55>
ServerName plain.ev1servers.net
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>



There were multiple entries like this in /etc/httpd/conf/httpd.conf so I went through and changed them all to my host name instead. Well, now I've realized I probably don't need the duplicates so is it okay to delete them? I'm not sure what I can safely remove because both of those entries are preceded by NameVirtualHost 555.55.555.55:80. It's the same IP address and everything. Can I safely delete the duplicate NameVirtualHost entry as well?
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
32
473
Go on, have a guess
Yes, you can. Those are created when EV1 setup the server with their own hostname configured before changing it to the one you choose.
 

Vatoloco

Well-Known Member
Jun 21, 2004
99
0
166
chirpy said:
Yes, you can. Those are created when EV1 setup the server with their own hostname configured before changing it to the one you choose.
Thanks! Do I need to leave one of the NameVirtualHost entries? There are only two in the entire file and I can't tell if they go with the ev1servers.net entries or if they are also used for my other virtualhost entries that I need to keep.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
32
473
Go on, have a guess
You need the NameVirtualHost directives if you use an IP address more than once in a VirtulHost container. There's no harm in having them in there, but if you do, they should be before any VirtualHost statement uses it.
 

PWSowner

Well-Known Member
Nov 10, 2001
2,901
4
343
ON, Canada
I clean my conf file up once in a while by moving all NameVirtualHost lines up so they are just before the VirtualHost entries. Then it's easy to see if there are duplicates and I leave just one for each IP.