1

I bought a new VPS from Softlayer and I'm having some issues configuring it. I haven't pointed the name servers to it yet.

The problem I'm having is, through WHM, I added a new account and it was setup properly. But when I access it with the IP address I get a 404 error. I uploaded a test.html file through cPanel to home/safepath.

Below is how I access it:

my.ip.address/~safepath/test.html

Can someone tell me what I am doing wrong here?

  • Some Apache installs assume a catch-all site by default. All IP address requests go there. If you can access your file via the domain name and not by IP, then your request is going to another web space. Check the 000-default.conf and upload your file there to test. If that works, then change the path in your 000-default.conf if you want your catch-all to default to your site. One warning however. You do this, then any incorrectly addressed request will default to your site. If this is not right, you can add a redirect for IP only requests. – closetnoc Sep 27 '16 at 13:05
2

To access a cPanel powered website by its IP address:

  1. You must enable mod_userdir.
  2. You must either issue a dedicated IP address or you need to edit the virtual host file and include the IP address. You would normally find this file in /usr/local/apache/conf/httpd.conf.

Alternatively the other and preferred method is to edit the local Windows or Mac OS host file locally, this way you can use a virtual domain even if you don't own it.

SOURCE

The most common and easy method to fix the issue would be to edit your host file within Windows or Mac, this will allow you to access all sites locally, using the domain name as you would externally...

The host file would look something like this:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#
192.168.1.1 exampleA.com
192.168.1.1 exampleB.com
192.168.1.1 exampleC.com
| improve this answer | |
1

For anyone having issues accessing cpanel accounts via IPADDRESS/~USERNAME -- I recently bought a new Gen 4 VPS from Godaddy (April 2020). I got 404 errors when I went to access new account. After I enabled mod_userdir, I was able to see the root of the account, but was unable to install Wordpress via Installatron. I kept getting another 404 error, claiming that the URL couldn't be validated for this IP address (except I was trying to install it on the IP address, not an actual domain name).

I paid for a phone support ticket with cPanel.net directly. The tech I worked with solved it in about 20 minutes. He said these setups are extremely temperamental, and you need to have the settings just right.

Here's what we did - I hope this helps someone else:

  1. mod_userdir must be enabled: Security Center > Apache mod_userdir Tweak > Enable mod_userdir Protection = checkbox > Save
  2. mbstring is a non-default php extension that must be enabled: EasyApache > Currently Installed Packages > Customize > PHP Extensions > (search) mbstring > install/enable (for all versions of php you are using) > review > provision
  3. Mod_ruid2 must be disabled: EasyApache > Currently Installed Packages > Customize > Apache Modules > (search) mod_ruid2 > uninstall/disable > review > provision
  4. suphp must be installed: EasyApache > Currently Installed Packages > Customize > Apache Modules > (search) suphp > install/enable > review > provision
  5. CGI cannot be used, you must use SUPHP In WHM > Software > MultiPHP Manager > PHP Handlers Tab > Edit from CGI to SUPHP for all versions of PHP you're using

Those are all the steps we went through. After each step the tech discovered something else that needed to be done, until finally after step 5 we were all set.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.