How do I remove a duplicate IP virtual host from httpd.conf?
Hi,
I have a domain (example.com) which points to 123.456.789.012. If I visit [url=http://example.com/]Example Domain, everything is fine. My problem occurs when I try to visit and am shown the default cPanel/Apache page.
I have checked /etc/httpd/conf/httpd.conf and see:
The obvious problem is that there are 2 VirtualHost's pointing for 123.456.789.012:80. I have searched everywhere but I don't know what or where I am meant to modify in order for the first VirtualHost (the one pointing to /usr/local/apache/htdocs) to be removed. As a test, I edited the httpd.conf file manually and removed that VirtualHost and restarted Apache. I was then able to access
NameVirtualHost 123.456.789.012:80
ServerName server.example.com
DocumentRoot /usr/local/apache/htdocs
ServerAdmin admin@example.com
suPHP_UserGroup nobody nobody
ServerName server.example.com
DocumentRoot /usr/local/apache/htdocs
ServerAdmin admin@example.com
suPHP_UserGroup nobody nobody
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/example/public_html
ServerAdmin admin@example.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/example.com combined
CustomLog /usr/local/apache/domlogs/example.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User example # Needed for Cpanel::ApacheConf
UserDir enabled example
suPHP_UserGroup example example
SuexecUserGroup example example
RMode config
RUidGid example example
ScriptAlias /cgi-bin/ /home/example/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/example/example.com/*.conf"
The obvious problem is that there are 2 VirtualHost's pointing for 123.456.789.012:80. I have searched everywhere but I don't know what or where I am meant to modify in order for the first VirtualHost (the one pointing to /usr/local/apache/htdocs) to be removed. As a test, I edited the httpd.conf file manually and removed that VirtualHost and restarted Apache. I was then able to access
-
Hello :) You can try rebuilding the Apache configuration file via: /scripts/rebuildhttpdconf
If the issue persists, could you check to see if any third-party applications are installed (e.g. Nginx, LiteSpeed) that could be altering the Apache configuration after you modify it? Thank you.0 -
Hi :) Unfortunately rebuilding the file didn't work. It displayed the following: info [rebuildhttpdconf] Missing owner for domain server.example.com, force lookup to root info [rebuildhttpdconf] Domain ownership conflict detected for example.com, users nobody, example Built /usr/local/apache/conf/httpd.conf OK
While I would like to fix both of those messages, I think it's the second that is causing the problem. I don't think I'm running anything that would interfere with the conf files... well, not that I can think of. Thanks for the quick reply!0 -
I'm guessing server.example.com is the server hostname. Is that correct? How are you wanting to handle requests to the server hostname? If it's a matter of changing the IP address for the server hostname VirtualHost, then you can do that in 'Basic cPanel & WHM Setup' within WHM. 0 -
Yes, server.example.com is the hostname. If possible, I'd like requests to the hostname to point to the site as well. ie. server.example.com should show the same content as example.com The IP address in "Basic cPanel & WHM Setup" is already set to the IP address of the server. Thanks for the reply! :) 0 -
You should not configure your hostname as an account on the server or as a domain name associated with an account. This is not supported, and can result in Apache configuration problems. You could use a separate IP address for the account if you want it's content to load on that IP address. Or, you can manually modify the Apache configuration file, positing the VirtualHost for the account as the first entry for the IP address. Documentation on how to preserve changes to the httpd.conf file can be found at: Apache Configuration Changes Thank you. 0 -
I don't have the hostname as an account. I was just saying that it would be nice if the hostname URL could be resolved too, but it's not a big deal if it doesn't. My concern still lies with the IP address URL. I'll look at the link given. Thanks again for the help :) 0
Please sign in to leave a comment.
Comments
6 comments