cPanel Profile Advice

Hello all, I'm installing cPanel (in a test environment) for the first time and was hoping to get some advice on how best to provision/configure Easy Apache 4.

I've been using NGINX for many years and although not new to server management at all, cPanel has a steep learning curve! The server I'm working on at the moment (and hope to take into production) has 2 CPU cores and 4GB of RAM.

My end goal is to create a shared hosting environment that is both flexible and secure to host your typical blogs, CMS's and e-commerce sites. This server won't be crammed full of accounts so I would like the sites to perform well.

I fully understand that not all environments are the same but I'd appreciate your feedback and any insights you might have on the below:

Apache MPM:

  • mod mpm itk - enabled
  • mod mpm prefork - enabled

PHP Versions:

  • PHP 5.6
  • PHP 7.0
  • PHP 7.1

PHP Extensions - various including:

  • ioncube10 for all 3 PHP versions above
  • PHP FPM for all 3 PHP versions above

I've opted to go down the PHP-FPM route. Would anyone recommend OpCache?

Would anyone recommend against MPM ITK? It's my understanding that this creates a more secure environment by running processes under a user's own access rights.

I've left my Apache global config fairly default.

Thanks!

1 Reply

Hi there,

As you stated, there many different cPanel configurations that you can go with, but let's try and focus on the following goal:

My end goal is to create a shared hosting environment that is both flexible and secure to host your typical blogs, CMS's and e-commerce sites.

It sounds like you're looking for just a general, all-purpose cPanel setup that might not be optimized for specific scenarios, but should work with most applications out of the box.

First, let's address your question of mpm-itk vs the standard mpm-prefork

mpm-itk allows you to run each of your vhost under a separate uid and gid.

cPanel provides mod_cgi and mod_ruid2 by default. This means that it is not compatible with mpm-itk. While mpm-itk used to be the recommended option, it looks like cPanel themselves have removed the recommendation to use it as of EasyApache4 (source)

While it comes with an upside of convenience since you can choose a different uid/gid for each virtual host without using other modules, there main limitation here is performance as it needs to create a process and destroy it for each query since it has to be running as a different user.

<hr>

I've opted to go down the PHP-FPM route. Would anyone recommend OpCache?

Personally, I prefer PHP-FPM as well. As for OpCache, I think the consensus that I've personally seen is that you almost always want to have it enabled for performance improvements in a production environment. From some research I've done, it also looks like it is secure:

Opcache w/FPM is secure. OPCache uses shared memory to cache compiled PHP "opcode" between HTTP requests for reuse. A single shared memory object is opened and initialized in a parent process, and child processes inherit its file descriptor. Due to this design, OPCache is intended for use with a SAPI with a persistent parent process, for example php-fpm with its master process, or apache2handler where initialization occurs in the Apache parent process.

(Source)

You may want to consider reading through this serverfault thread here though, for some security concerns about the cache being shared across all users.

<hr>

Would anyone recommend against MPM ITK? It's my understanding that this creates a more secure environment by running processes under a user's own access rights.

Unless you have a specific reason for wanting to run Apache under specific uid/gids, I prefer to use separate PHP-FPM pools for isolation and separation of user processes. MPM ITK is an older solution which is easy to configure but may be unnecessary unless you have a specific reason for wanting it (Which personally, I'm not aware of any good ones).

<hr>

To summarize, while I'm no expert on any of this, I have played around with a few of the technologies/modules you've mentioned, and I tend to run PHP-FPM on almost all my stacks (whether it be cPanel or my own LEMP stacks). Hopefully, I was able to provide a little bit of insight and perhaps point you towards possible other sources that you may want to check out. There's a LOT of older resources out there which are a pain to go through, but as obvious as this may sound -- If you left most of the configuration options fairly default, you should be good to go for a "fairly default" setup where you want to maximize compatibility with your different web applications while performing fairly. In regards to security, I would definitely go through the cPanel documentation for any specific flags for a setting you might be looking at, but I would definitely recommend going through this article (here) on hardening your system.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct