cPanel is a server control panel which allows users the ability to access and automate server tasks and, provides the tools needed to manage the overall server, their applications, and websites. Some features include the capability to modify php versions, creating individual cPanel accounts, adding FTP users, installing SSL’s, configuring security settings, and installing packages to name a few. cPanel and WHM have a vast range of customizations and configurations that can be completed to further personalize your platform specifically for your needs. It also includes 24/7 support from cPanel as well.
When purchasing a server from Liquid Web, we offer several images your server can be built from. We offer these images on most of our hosting products, including, dedicated servers, cloud dedicated servers, and our VPS offerings. Another bonus is that cPanel is supported out of the box on our fully managed servers. Our staff is well versed in providing assistance as well. Our automated install process will install and setup cPanel on your server. If you happen to have a cPanel license or are utilizing cPanel’s free trial, then please continue reading as we will be discussing how to install and setup cPanel on a CentOS 6 or 7 Linux box.
NGINX is a webserver that is becoming an increasingly popular option for webhosting, as sixteen percent of all sites on the internet are utilizing NGINX. This percentage is constantly increasing as clients are in need of a web server that can serve content faster. It can also be used for proxies, reverse proxies, load balancing, and more depending on what modules you load onto NGINX. One of the significant differences between Apache (a popular webserver) and NGINX is the way each system handles access rules. If you are familiar with using .htaccess rules in Apache, then the method that NGINX uses of including directives in the server’s vhost block will be substantial change.
Times are changing, and possibly your hostname is too if you are reading this article. You may have come across a scenario within your business that requires you to change your hostname. You might ask yourself why you would need to change your hostname? The most common scenarios would be due to a domain name change, your business has changed its course, or because you have thought of something better.
Sometimes you might forget to renew the domain names before they expire. Unfortunately, this can be a time where a domain brokers purchases you domain name. These are agencies who take popular sites and purchase with the intent of holding the domain until their inflated price is met. As unfortunate as this may be, sometimes it is best to purchase a new domain name for cost efficiency.
When purchasing domains from Liquid Web you can always select the option to Auto Renew within our portal Domains >> My Domains
Benefits to using a Fully Qualified Domain Name for your Hostname
It is good practice to use your FQDN “Fully Qualified Domain Name” as your hostname. Following this practice creates more options for securing your hostname with an SSL. This will allow services like email to function using a secured connection. Using a hostname with a registered domain will allow you to add a corresponding DNS entry. This will prevent unpredictable behavior by some services that use the hostname. This would allow you to set up a reverse lookup DNS entry. It can be very important especially with services like email verfication. For example, when an email is sent the receiving server runs a reverse lookup on the sender’s hostname. The reverse lookup allows receivers server to ensure the hostname resolves to the matching IP address. This is just one preventive measure servers now use to reduce email spoofing incidents.
By using a unique domain name, you can reduce editing time. You may have a script that calls to the servers IP, instead of the hostname, to correctly function. Best practice is to use the hostname because future migrations may change IP addresses/ranges. Using the hostname can save you a lot of time in the long run, depending on your infrastructure and coding.
Using SSH for Windows 10, 7/8, and Mac OS X
We’ll need to connect to your server. For this article, we will be using SSH “Secure Shell” to access the server and issues commands. SSH is a powerful tool that will allow us to establish a secure connection with your server, diagnose, and issue remote commands. For more information on the SSH protocol, you can visit the following links.
Note: Because the OpenSSH client was introduced in the Windows 10 Fall Creators Update, you’ll need to first update to at least that version of the operating system.
Unfortunately, for older versions of Windows, it is not exactly possible to set up an SSH natively to connect to your server. Thankfully, applications were created to assist. We like to use MobaXterm, but Putty is a safe choice as well. Both of these applications are free to use and simple to set up. We’ve included links below with more information on these applications.
Newer Mac operating systems come with an excellent utility to access SSH called Terminal. To access Terminal navigate to your Applications folder >> Utilities folder >> Terminal.
In case Terminal is inefficient for your preference, there are other options available in the App store or through a quick search on Google . Putty is also available on Mac!
Changing the Hostname in Ubuntu 16.04
At this point, you should be able to access your server using SSH. Once you have accessed your server, you will want to either switch to the root user or run these commands using sudo. The files you will be accessing are owned by root. Because of this, you will need root privileges.
To start things off, we will want to edit /etc/hostname and the /etc/hosts files. You can do so by using a text editor of your choice. We will demonstrate how to accomplish this task using the text editor called VIM. Some of these command line text editors can seem complicated, we will include the “sed” command to make things even easier.
Switching to root user:
# su – root
Editing the hostname and hosts file:
# vim /etc/hostname
# vim /etc/hosts
Once you have opened these files, you will need to change your hostname as follows:
Press the i key to insert. This will allow you to edit. You will notice the editor says “Insert” at the bottom of the page.
Use the arrow keys to navigate the cursor to your old hostname.
Backspace to delete single characters
Replace with the new hostname. Be sure the syntax is correct.
When done editing hit the ESC key to exit insert mode.
Then hold shift andpress the : key
Finally, type wq and press enter key. This will write to the file and quit the editor
Repeat for /etc/hostname
As we mentioned earlier, the command line text editors can appear to be overly complicated, especially when you’re used to programs like Word and the Window’s text editor. Because of this, we have included the command below.
Change host.example.com to your old hostname. Change host.newhostname.com to your new hostname
# sed -i 's/host.example.com/host.newhostname.com/g' /etc/hosts
# sed -i 's/host.example.com/host.newhostname.com/g' /etc/hostname
Your SSH session should be terminated. Depending on your server it can take a few minutes to boot back up. Once the server is back online you can check your changes by running the following command:
If all went well, the terminal should output your new hostname.
If you wish to reboot at a later time but still want your new hostname to take immediate effect, you can use the hostname command to temporarily set the hostname until the next reboot. From there, the changes in /etc/hosts and /etc/hostname will take permanent effect.
# hostname host.newhostname.com
There is also an alternative available. The hostnamectl command is default for both Desktop and Server versions. They combine setting the hostname via the hostname command, editing /etc/hostname and setting the static hostname. Unfortunately, editing /etc/hosts still has to be done separately.
# hostnamectl set-hostname host.newhostname.com
Common Issue after Hostname Update
The “Failed to start hostname.service: Unit hostname.service is masked” error can happen when there is a syntax error within the /etc/hostname, or /etc/hosts file, or when the hostname does not match between these two files. Be sure to check both of these files for mistakes and correct them as needed. In newer versions of Ubuntu, you will also want to use the hostnamectl command mentioned earlier.
# hostnamectl set-hostname host.newhostname.com
Once corrected, be sure to start the hostname service to see if the issue has been corrected. You can do so by running the command that we have included below. Afterward, we would recommend rebooting your server. This is not always necessary, but in some cases, it is required.
# systemctl restart hostname
As always, Liquid Web customer’s enjoy 24/7 technical support with changing your hostname. Reach out to our sales team to see how you can get into our lightening fast servers today!
Webmin is a browser-based graphical interface to help you administrate your Linux server. Much like cPanel or Plesk, Webmin allows you to set up and manage accounts, Apache, DNS zones, users and configurations. As these configurations can get somewhat complicated Webmin works to simplify this process. The result is fewer issues during server and domain setup. Which results in a stable server and a pleasant administration experience. Unlike Plesk or cPanel, Webmin is completely free and open to the public. Unfortunately, here at Liquid Web, we do not offer managed support for Webmin, but we are always willing to assist as much as possible when issues arise. You can download Webmin from their site. Also, you can find some excellent documentation on this interface.
Before beginning “if you have not already” you will need to install Webmin on your server. For this article, we will mainly be working with Webmin installed on a Ubuntu server. However, it is very similar to CentOS, therefore, we have included instructions for both operating systems below.
First, you will need to access your server SSH. If you are not sure how to SSH into your server, please visit our link on the subject.
Once you are logged into your server SSH, please run the following commands in order or copy and paste the entire syntax.
Webmin is a web-based application. So once Webmin is installed, you can access Webmin by using a browser of your choice. Be sure to make sure port 10000 is open on your server as Webmin utilizes this port to function. We have included steps below to ensure the correct port is open for iptables and firewalld.
iptables-save > /tmp/tabsav
iptables-restore < /tmp/tabsavYou should be able to use the command above to alter you iptables to look something like what we have included below. # Generated by iptables-save v1.4.7 on Thu Jan 3 00:02:49 2019
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [3044:1198306]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibited
# Completed on Thu Jan 3 00:02:49 2019
firewall-cmd --zone=public --add-port=10000/tcp --permanent
Once you have made sure port 10000 is open, you should be able to access the Webmin interface by entering in your servers IP address followed by the port number “10000”
Example: https://192.168.1.100:10000 <—— 192.168.1.100 should be replaced with your server IP.
Installing PHP Versions in Webmin
There is a lot of situations where we may need to use multiple PHP versions. For example, you may have multiple domains or applications on your server that require an older version of PHP while at the same time you may have newer domains that are configured for newer versions of PHP. For this article, we will be installing PHP7 and PHP5.6 on Debian.
Step 1: First, you will want to SSH into your server and run the following command. apt-get install php7.0-cli php7.0-fpmYou can check the installation after it has completed by running php –v in your terminal.
Step 2: Now here is where things tend to get tricky. By default, Debian only offers a single PHP version in the official repository. So, we will have to add an additional repository for Debian. While adding this repository, it is good practice to enable HTTPS for APT and register the APT key. You can accomplish this by executing the commands we have included below.
Once the repository is added, we can go ahead and add our second PHP version to the server.
apt-get install php5.6-cli php5.6-fpmWe can now check both PHP versions on the server by running these commands.
Now that we have confirmed both PHP versions are installed you can access their configuration files in the following directories.
Step 3: To make things easier, later on, we will want to add the location of the configuration files to Webmin. This can be done from within the Webmin interface.
Log into Webmin
Navigate to Others >> PHP Configuration
Add the PHP configuration file location
You can use this tool to add and edit directives for different PHP versions. For example, you’ll be able to edit PHP’s memory limit, timeout length, extensions and more. This simply helps consolidate configurations within one interface. From here we can just use a .htaccess file to specify what version of PHP a site should use.
Step 4: If you do not have this file already within your document root you can add this file by navigating to /var/www/exampledomain/ and running the following command to indicate which PHP version you are going to use.
Step 5: Once you have completed this, you can test to see if your site is running on the desired PHP version. You can accomplish this by creating a PHP information page. by making a file in your document root, usually in the path of /var/www/html/
You will want to insert the code below and save the file.
<? phpinfo(); ?> After you have created this file, you can view the page by visiting your domain followed by the name of the file you created. For example, www.example.com/phpinfo.php.
Congratulations you can now use Webmin to accomplish your daily admin tasks! Take a look at our Cloud VPS servers for 24/7 support and lightning speed servers!
EasyApache 4 installs, configures, updates, and validates your Apache, PHP and other services on your server.EasyApache 4 also supports multiple versions of PHP. This allows you to assign different versions of PHP to each of your domains. There are great tools that have been implemented with EasyApache 4 that makes managing PHP versions simple. Two of these are the MultiPHP Manager and MultiPHP INI Editor. These can be found within the Web Host Manager, or “WHM” for short. With the addition of these tools in cPanel/WHM, users can now complete most of these tasks from the Graphical User Interface. However, it is worth mentioning, attempting these tasks from the command line is recommended as we have seen better performance when compiling Apache builds.
If you are still using EasyApache 3, please contact our support for assistance upgrading your server to EasyApache 4. EasyApache 3 is no longer being supported as of December 31st, 2018. This means there will be no further updates for this service. This can create security risks and should be addressed. Also, cPanel will not allow you to update to version 78 or newer using EasyApache 3. Before considering upgrading, please be sure you meet the following requirements.
EasyApache 4 requirements
Utilize Apache 2.4 or newer, updating Apache from 2.2 to 2.4 can be done from WHM using EasyApache 3, but it is recommended to run from the command line. You can read more about this here.
It is recommended for the system to use suPHP as the default PHP handler. More information on handlers can be found here.
CentOS 6, CloudLinux 6, Red Hat Linux 6 or higher
If you are still running CentOS 5 or older “due to the security risks” we would highly recommend migrating to a newer operating system as soon as possible. More than likely your current server’s hardware is also obsolete. Due to the complexities of our packages, we would recommend migrating to a new server. If you need any assistance choosing a new server, please reach out to us. Our team will gladly assist you in selecting the perfect package that will provide you with the best performance possible.
PHP versions 5.4 or higher. If your site is using PHP 5.3 or older, you will need to update and confirm your site is compatible with PHP Versions 5.4 or higher.
MySQL/MariaDB are using updated hashes. The older versions of MySQL use an incompatible hashing algorithm. Mysql 5.6 and later use an updated secured hash. Since EasyApache 4 uses mysqlnd “the MySQL Native Driver” this will need to be addressed before upgrading since mysqlnd does not support older hash.
Once you have met these requirements, your server is ready to upgrade EasyApache 3 to EasyApache 4. When upgrading EasyApache we would recommend beginning this task at a time your server is not expecting much traffic as the process can take 20 minutes to a few hours. This depends on your specific server’s performance and overhead. If you require any assistance with meeting the requirements needed to upgrade or would like to schedule an upgrade. Please call, start a chat or submit a ticket with our support team.
Other than the requirements there are a few other obstacles you may need to check.
Be sure the suPHP_ConfigPath directive is not being used in any .htaccess file as unexpected behavior may occur. You can correct this by removing or commenting this directive out within the .htaccess file. (The .htaccess can be found in /home/$cpaneluser/public_html or /home/$cpaneluser/)
Find any php.ini or .user.ini that will try to reference the old environment variable, extension_dir, either the line will need to be removed or corrected. (The .php.ini/.user.inican be found in /home/$cpaneluser/public_html or /home/$cpaneluser/)
Upgrading EasyApache 3 to EasyApache 4 Script
Access your server via SSH and insert the following command:
To revert back to EasyApache 3
/scripts/migrate_ea3_to_ea4 –revert –run
Once EasyApache 4 is installed, please be sure to test your sites for any errors and confirm that WHM/cPanel is up to date.
Configuring Apache and PHP Using EasyApache 4
1. Login to WHM and access EasyApache 4 by using the search bar.
WHM >> Software >> EasyApache 4
2. Once you have navigated to EasyApache 4 you can view, customize and provision available EasyApache profiles. Click the button under
Currently Installed Packages.
By default EasyApache 4 comes with additional profiles that help minimize setup up time as there are a few options tailored to the end users’ needs. If needed you still have the ability to create your own profiles for even further customization. For more information on EasyApache 4 profiles, you can view this documentation from cPanel.
3. From the “Apache MPM” menu you can select which Multi–Processing Module, or “MPM” you would like to use. This will determine how Apache will handle incoming requests and how it processes them. You can select which MPM you would like to use by clicking the toggle button to the right of the module. If you are unsure on which MPM to use, check our tutorial to help you decide. Once selected click Next.
4.The “Apache Modules” section will allow you to select and install needed Apache Modules. Once the needed modules are selected, click Next. Apache Modules can add extra functionality to Apache. For example, the mod_ssl module can be selected from this interface. This allows Apache to process traffic using the Secure Sockets Layer “SSL v2/3” and TLS “Transport Layer Security”. For more Information on Apache Modulesvisit this link, which details more specific information on Apache Modules.
5. From the PHP Versions menu, you can select which versions of PHP you wish to install. WHM will automatically check for extensions currently being used by other versions of PHP on your server. More than likely these extensions are currently being used by one of your domains, and because of this, we recommend selecting the PHP X.X and Extensionsbutton when selecting a version. After you have selected the versions you want to install, clickNext.
If possible we would highly recommend using the most recent version of PHP as PHP version 5.6 and 7.0 will no longer have security updates as of January 1, 2019. For more information on supported PHP versions visit this link.
6. From the next menu, the PHP Extensions menu, you can select all PHP extensions you require. PHP extensions enable particular functions used in your PHP code, an example of this would be if your PHP code communicates with MySQL you will need to utilize the “mysqlnd” extension. EasyApache 4 has already selected recommended extensions that existed on previously installed versions of PHP on your server by default. A good tip is to limit the selection view to only the version of PHP you are installing. You can do so at the top of this page by deselecting the boxes next to Filter by PHP Version. Once you have selected your PHP extensions click Next.
7. The next two sections are not commonly used, however, they are included for those that require these functions. Ruby via Passenger allows you to integrate Ruby, Node.js, and Python applications on your server. Within this menu, you can install/select which Ruby modules you would like to use. More information on this can be found in this link.
Within the Additional Packages menu, you can select custom packages to be installed on your server. Currently, by default, the only option available is Tomcat 8.5. Tomcat is a Java Servlet Container that allows you to run Java–based application on your server. You can save the profile to be used for later by clicking Saveas profile button on the bottom-right corner of the page.
Once you have finished your selections, click Next or Review. You should see a notification like the one we have included below. This can take a few minutes to complete so allow it some time to poll your results.
8. Please be sure to review this next page to make sure you have selected the desired configuration. If you notice anything is missing or should be changed, you may return to the relevant menu to adjust the selections. Once reviewed, scroll down to the bottom of the page and click the “Provision” button.
Once you have begun provisioning, please allow EasyApache some time to finish. You will be prompted once the process has finished.
Congratulations, you have selected an MPM, installed additional Apache Modules, PHP versions, and PHP extensions using EasyApache 4.
Using the MultiPHP Manager from WHM
cPanel’s MultiPHP Manager allows users to manage cPanel accounts PHP configuration on a per domain basis. This feature is only available on EasyApache 4. You can also set the system’s default global PHP version for all accounts, enable PHP-FPM globally or per domain, and adjust PHP-FPM pool options.
Selecting System default PHP Version
Navigate to the MultiPHP Manager (WHM >> Software >> MultiPHP Manager)
Setting the system default PHP version will not change the PHP version for all domains. Your cPanel account “if not defined” is set to inherit by default. If the inherit option is enabled, the account will use the system’s default PHP version.
Click Edit under System PHP Versions.
Select the desired PHP version and click Apply. You should see a Success notification at the top right of the page if the change was successful. It will also display any errors that may have occurred.
Define PHP Versions per Domain
Within the MultiPHP Manager, you also can set the desired PHP version on a per domain basis.
Select the domain or accounts you wish to alter.
Click the drop–down menu located in the PHP column.
Select your desired PHP version. The interface will prompt you once the change has completed.
Changing PHP Versions on Multiple Accounts
Select which accounts you would like to alter by clicking the check boxes next to the domain.
Click the drop–down located in the type right.
Select the desired PHP version and click Apply. The interface will prompt you once the change has completed.
MultiPHP INI Editor
MultiPHP INI Editor is a great tool that allows you to manage PHP settings per version. You can quickly edit the most commonly adjusted PHP directives from within the Basic Mode or for more advanced users you can edit the configuration files directly using the Editor Mode. For information on directives, please read PHP’s documentation which can be found here.
To access the MultiPHP INI Editor login into WHM. (WHM >> Home >> Software >> MultiPHP INI Editor)
Basic Mode allows you to view and edit directive values for your selected PHP version. WHM will save changes to the PHP configuration file. Also, directives will only show if the version of PHP you are editing supports that directive. With WHM assistance this greatly helps minimize errors as the syntax within these files are sensitive.
Edit PHP Configuration Using MultiPHP INI Editor in Basic Mode
Select a PHP version from the drop–down menu.
Adjust directives as needed. For example, you can increase upload_max_filesize by editing the field to the right of the directive.
Click Apply to submit changes. If the edit was submitted successfully WHM will notify you at the top right of the page. It will also inform you if any errors have occurred.
Adjust directives as needed. For example, you can increaseupload_max_filesize by editing the field to the right of the directive.
Click Apply to submit changes. If the edit was submitted successfully WHM will notify you at the top right of the page. It will also inform you if any errors have occurred.
Edit PHP Configuration Using MultiPHP INI Editor in Editor Mode
Editor Mode allows you to modify additional directives and PHP configurations that are not available in Basic Mode. Please note, errors within this interface can result in errors causing PHP scripts not to function correctly. Unlike Basic Mode which loads directives available to that version of PHP, Editor Mode loads the contents from the .ini file for the selected PHP version. If the file does not exist then, the interface will load a blank editor. When saving values or configurations to a blank editor, the systems will create a new file.
From within MultiPHP INI Editor click the Editor Mode tab.
Click the drop–down menu to select PHP Version.
The Editor will open the file as a text document. From here you can simply edit the configuration to your needs.
Click Save to submit your changes. If the changes were successful WHM will display a success notification in the top right of the screen as well as any errors that may have occurred.
EasyApache 4 makes adjustments and server tuning a breeze. However, there is still a chance the end user can make a fatal mistake. A quick call to our support staff could bring a quick resolution to your issue. There are some cases where the best solution possible, is the fastest the end user can apply themselves. For cases such as these, we would highly recommend utilizing our Cloud Backups. Cloud Backups offer an extra layer of protection as your backups are stored on a remote device we manage here at Liquid Web. This ensures full restoration in the unlikely event of a total system failure. The end user can manage and restore easily from our manage page. For more information on how Cloud Backups can work for you visit our products page.