Normally when you type in the main server IP, it takes you to the Apache and Cpanel has instealled successfully page but for my case when I type in the main IP for my server, it re-direct me to my main domain name. How do you solve this problem? Thanks
Normally if you just type in the IP address, Apache shows you the contents of the default directory as it wasn't given a domain name. If it's automatically redirecting you to a domain (eg, you type in xxx.xxx.xxx.xxx and it redirects you to www . whatever. com) then it's most likely a redirect rule in place (either in the site's .conf file, a .htaccess file or in index.php) in the default www directory. If it's merely displaying the content of the main site, you'll need to change the settings for the default Apache www directory.
From the 2 cases you mentioned. I think it's case 1 but my main site .htaccess is blank and there is no config file on my main site. Beside, htaccess only effect when people actually type in the domain instead of IP. For instance, if I want people to auto redirect from MyDomain.com to www.MyDomain.com then I will edit my htaccess in MyDomain.com Public_html directory. I think it must have something to do with DNS Zone.
Look in the main Apache conf file, it'd probably be there then as like I said, if you type in just the IP address of the machine, Apache will return the default site configured on it. All .htaccess files do is allow you to use Apache directives at the directory level. You can do all sorts of redirects with them, not just those based on the domain name. Depending on how your server is setup, you could have redirect rules in an .htaccess file the default dir (normally something like /var/www/, /var/www/html/ or /var/www/apache/) or (more likely) in the main Apache conf file. No, by typing in the IP directly you are bypassing DNS altogether, as all DNS does is map IPs to domain names. The fact that you get redirected shows that the server itself is configured to do that
That depends on what flavour of linux you are using, and if you compiled from source or used a package manager. Assuming you used a package manager (yum, apt-get, etc), it'll always in be in /etc/, normally in a subdirectory like httpd or apache or apache2. The filename itself will be something like httpd.conf, apache.conf, apache2.conf
What flavour of linux are you running? The setup of the conf file will be different depending on who compiled the package for which flavour. In the meantime, if /usr/local/apache/conf/httpd.conf is the config file (strange that it's not in /etc/ like it should be...) you could try look through it for something like "Section 2: 'Main' server configuration'. Hell, if you have SSH access (which you do by the sounds of things) you could just grep the file for the domain name, eg: grep -i "domain.com" /path/to/httpd.conf | grep -v "#" That command will search for lines containing domain.com (case insensitive) in the file /path/to/httpd.conf and then remove any commented-out lines. Although I'd highly advise you to not mess about with the httpd.conf file unless you know what you're doing.
Hi, This is occuring because your main domain is the default virtual host in the apache configuration file. It has likely become the default simply because it is the first vhost configured for that IP address. You need to move the virtual host what you want to be default above all the other virtual hosts for that IP address.