Best Apache + PHP configuration for a fresh server?
Hey,
I'm currently deploying a fresh cPanel server (bare-metal). I don't need to migrate any old accounts so I can just have a fresh start.
I would like to:
- offer "modern stuff" like http/2, compression, amp etc
- use php-fpm as much as possible
- offer caching (memcache, opcache etc)
- isolate users/threads while dropping suPHP
- allow users to benefit from WordPress's auto-upgrade feature (so Apache should run each user's processes via user, similar with the old suPHP configs)
- support PHP7x exclusively (so no 5x required)
- not use CloudLinux (CentOS 7)
- have a snappy/light&functional config, without installing a ton of legacy stuff
- What Apache MPM should I choose? Prefork doesn't allows http/2, right?
- What Apache Modules should I choose?
- What's the best/recommended caching method (memcache, opcache etc)?
-
Hello @Razva To answer your questions please see the following: What Apache MPM should I choose? Prefork doesn't allows http/2, right?
Prefork does allow http/2 but it does come with restrictions. Please see apache's documentation on this here: but you'd probably be just as well off if you're using worker unless you need prefork for compatibility reasonsWhat Apache Modules should I choose?
We can't tell you all the apache modules you'll need but you might want to look up some for your specific needs though you will get a lot of these on a default cPanel installation but here are some other threads that go over this info: And documentation on modules as well as default apache profiles that come with cPanel's EA4:What's the best/recommended caching method (memcache, opcache etc)?
I'm not sure if I can tell you which would be better for you since they serve somewhat different purposes but here is some further information on both opcache and memcache:0 -
but you'd probably be just as well off if you're using worker unless you need prefork for compatibility reasons
What "compatibility reasons" should I consider? Is there some user script/cms that might not work in a certain configuration, or we're talking- run "modern" protocols (http/2 etc)
- run "as much fpm as possible" as it has obvious speed/memory advantages
- allow caching as this is vital for "everything 2018"
- allow CMS auto-upgrades (so files written via apache/fpm should be owned by the user not by the daemon)
- have a setup as secure as possible for a non-CloudLinux environment Thank you
0 -
Hi @Razva prefork is basically compatible with basically everything but in your case since you want to use http/2 due to the restrictions imposed I think you'd be better off with worker . From Apache: [QUOTE]This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server. Each server process may answer incoming requests, and a parent process manages the size of the server pool. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other.
You can read about here: prefork - Apache HTTP Server Version 2.4 You can also read the other MPM descriptions such as worker here worker - Apache HTTP Server Version 2.4 I would suggest reading about them both, stackoverflow has some great discussions on the benefits and demerits of them both which I would suggest looking into. If you're going to be using CloudLinux the following goes over the most Optimal base EasyApache profiles for CloudLinux EasyApache Profile Stage - Easy Apache - cPanel Documentation - LSPHP wouldn't be a bad choice if you're going with CloudLinux as well. There's some wonderful information on LSPHP at Cloudlinux's docs here: CloudLinux Documentation I understand it's a lot of information and it can be daunting but we can't point to one configuration and say "that's the one" as a lot of it is going to depend on preference. You might also want to work with a system administrator to determine the best configuration for your content. If you don't have one you may find one here: Resources | cPanel Forums. Thank you,0 -
If you're going to be using CloudLinux the following goes over the most Optimal base EasyApache profiles for CloudLinux
As specified before I don't want to use CloudLinux, hence the questions about fpm/lsphp. The default cPanel install (after fresh install) has "nghttp2" (+libnghttp2). I couldn't find them on EA4. Any hints on this? Thanks0 -
Hello Those are http/2 C library and tools they're necessary for the function of http/2: ea-nghttp2.x86_64 : Meta-package that only requires libnghttp2 ea-libnghttp2.x86_64 : A library implementing the HTTP/2 protocol you can read about them here: Nghttp2: HTTP/2 C Library - nghttp2.org The actual http2 module is: ea-apache24-mod_http2.x86_64 : HTTP2 module for Apache HTTP Server You can use LSPHP without CloudLinux as well. They have instructions on how to install it on their site here: litespeed_wiki:cpanel:easyapache4-config [LiteSpeed Wiki] But keep in mind if you don't want CloudLinux you'll need to use Litespeed (LSWS) as the webserver in order to utilize lsphp (it can be installed but the only way it would be useful without CloudLinux is to use Litespeed) 0 -
You also can use mod_mpm_event with http/2 I run my server with mod_mpm_event with http/2 event - Apache HTTP Server Version 2.4 I have customized my servers in such as mod's and extensions in EasyApache and seem to work good. It is all up to you on what and how you want your servers to do. 0
Please sign in to leave a comment.
Comments
6 comments