How to use hosts file to preview your website on new server

For cPanel users the default preview URL tool can cause some issues for complex sites, images may not load which can make checking everything is fine difficult or impossible.

Thankfully there is another way you can check your site, although it does mean editing your hosts file.

Editing the hosts file on your PC to bypass the DNS lookup and access the site on your webhosts servers through your main domain rather than the preview URL.

This only affects your PC and visitors to your website will see the site as normal.

Windows:

You need to open it with Administrator permissions, to do this right-click on the NotePad icon, select “Run as Administrator”.

Now, in NotePad open the file:  c:\windows\system32\drivers\etc\hosts

On OSX and Linux you may need to use sudo to gain root privileges to edit the file.

Mac OSX /private/etc/hosts

Linux /etc/hosts.

Once your hosts file is open add the following line:

Code:
192.168.1.1 www.danrodgers.uk danrodgers.uk

Replace 192.168.1.1 with the IP address of your site, as displayed in your control panel and replace “danrodgers.uk” with your real domain name.

Once you have made the change, save the file.

Now when you browse to your website as normal. You will see it served from the new server and will be able to test the full functionality of your website before editing the DNS

To view the site on your existing host, just remove the line from your hosts file.

Note: If this doesn’t work you might need to reboot your PC for the change to take effect.

How to increase upload limit for PHPMyAdmin (PMA) on cPanel WHM

It’s been a while since I’ve setup cPanel, and I ended up scratching my head wondering why the PHPMyAdmin upload limit for the import tool wasn’t going up when I changed the main PHP.ini.

Eventually I remember cPanel plays by its own rules.

So, for future Dan, or anyone else who’s been stuck by this – here’s how to adjust cPanel’s max upload size!

In WHM navigate to Server Configuration > Tweak Settings and select the PHP tab – Here you can adjust the cPanel PHP max POST size and cPanel PHP max upload size to your desired max upload size.

 

How to bypass RAM check on cPanel DNSOnly Install

I recently re-purposed a small (10GB Disk, 512 MB RAM) VPS into a 2nd DNS server, using cPanel DNSOnly.

However, the cPanel DNSOnly installer does a RAM check and requires 768MB RAM to proceed.

Being as I only plan on running a few domains on this cluster 512MB will be more than enough under normal circumstances, thankfully there’s an easy way to bypass the check.

Firstly, if you haven’t done so already you’ll need to download the latest cPanel DNS Only.

# cd /home

# curl -o latest-dnsonly -L https://securedownloads.cpanel.net/latest-dnsonly

Secondly, you need to run the install with the “–keep” flag. This keeps the install files instead of cleaning up after itself.

# sh latest-dns-only –keep

Now, you need to edit the install file and reduce the $min_memory_rules array to 512.

# cd /home/installd

# vi install

Console Install File
We can still dream of that better world

If you’re running CentOS 7,  you’ll need to edit the 2nd element instead of the default.

How to secure a cPanel server against BEAST attacks

Last year a previously theoretical attack surfaced which can allow TLS security to be manipulated and weakened, it’s a simple attack and one which a simple configuration change can patch. Learn more about the BEAST attack on TLS here.

To patch Apache in cPanel is a simple 2 step process.

Step 1:

Login to WHM and navigate to: Service Configuration -> Apache Configuration -> Global Configuration

Here select the custom option for “SSL Cipher Suite” and enter the following:

ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH

Click Save, then click, Rebuild Configuration and Restart Apache to compile the config change.

Step 2:

In WHM navigate to: Service Configuration -> Apache Configuration -> Include Editor

Select “All Versions” under the “Pre VirtualHost Include” section.

In the text box enter the following:

SSLHonorCipherOrder On

Click Update, then Restart Apache.

Your cPanel server should now be patched against the BEAST TLS attack, you can verify this using a security checking tool such as SSLLabs.