How to configure apache2 to use php-fpm on Ubuntu

preview_player
Показать описание
► Skype: cuongnq87

Hello, My name is Cuong, I'm a Magento Developer. Welcome back to my tutorial videos.

Today, I am going to show everybody the best practice on Ubuntu, How to configure apache2 to use php-fpm on Ubuntu.

What is the PHP-FPM and why should we use it?

PHP-FPM (FastCGI Process Manager) is an alternative to FastCGI. It is developed to help PHP-based websites run faster. It's designed to speed up PHP processors and scripts. If you're running a PHP-based website or CMS platforms, like Magento, WordPress, Joomla or others, you should install and enable PHP-FPM to speed your website up.

In this video, I assume I had apache2, php7.1 on my localhost, then I only show everybody the basic steps to configure apache2 to use php-fpm on Ubuntu 16.04.

Try to run this command lines on your server.
- cat /etc/*release, I have Ubuntu 16.04 on my localhost.
- apache2 -v, I installed apache 2.4.18 on my localhost.
- php -v, I installed php 7.1.26 on my localhost.

Let's complete this practice, you need to follow steps by step:

Step 1: Installing and enabling the necessary extensions and modules
- Run the following command lines:
1. Install the FastCGI module: apt-get install libapache2-mod-fastcgi
2. Install the php-fpm extention: apt-get install php7.1-fpm
Because I installed php7.1 on my localhost so I must install php7.1-fpm
- If you are using php7.0, you must install the extension php7.0-fpm, you can search for php-fpm version on your server by running the command line: apt-cache search php
- a2enmod proxy_fcgi setenvif
- a2enconf php7.1-fpm
- service php7.1-fpm start
- service apache2 restart
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360

Step 2: Configure Apache2 Default Site to use PHP-FPM
- Disable mod_php: a2dismod php7.1
In the settings, we checked if the module php disabled, then using proxy_fcgi module. So we need to disable the php module
- Restart Apache2:
apache2ctl configtest
service apache2 restart

Step 3: Test and see the results

Yeah! it works perfectly. It is easy to configure Apache2 to use php-fpm on Ubuntu.

Thanks for watching guide. If you have any questions about this practice, please feel free to leave a comment below.

Don't forget to like, comment, share my videos and subscribe to my channel for getting the latest lessons.

Please do not hesitate to contact me, if you need me to join your Magento project. My rate is $25/hour in Magento 1 and $30/hour in Magento 2.
Рекомендации по теме
Комментарии
Автор

Don't forget to like, comment, share my videos and subscribe to my channel for getting the latest lessons.

MagentoTutorial
Автор

You made my day with this video
!!! Thanks man

😃

wilfriedadeniyi