Execute the following command to enable the configuration file. Now, we also have to enable this configuration file so that Apache can pass PHP files for processing to Fast Process Manager. Once done, press CTRL+X followed by Y followed by the Enter key to save our configuration file. Īlias /php7-fcgi /usr/lib/cgi-bin/php7-fcgiįastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /run/php/php 7.2-fpm.sock -pass-header Authorization -idle-timeout 60ĭo not forget to replace the PHP version number with the version you have installed on your server. Now, paste the following content in the file while your nano editor is open in edit mode. $ sudo nano /etc/apache2/conf-available/nf The configuration file will contain information about our PHP Fast Process Manager that Apache can use to pass requests.Įxecute the following command to create an Apache configuration file. To enable this configuration globally, we just have to create a configuration file in our Apache installation. But we still have to tell our Apache web server to pass PHP requests to PHP fast process manager. Right now, Our Apache web server and PHP-FPM are configured and can work individually. Configure Apache with PHP-FPM on Ubuntu 18.04 Once the PHP is ready, we can now configure our Apache web server to pass PHP requests to FPM. You should see the PHP version along with some other information regarding your PHP installation as an output of the command. Verify the installation by executing the command given below. For example, replacing 7.2 with 7.1 will install PHP7.1 on your server. If you want to install the different version of PHP, just replace 7.2 with 7.X. Once the process is complete, PHP is ready to use on our server. This process will take approximately one minute to complete. $ sudo apt-get install php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-curl php7.2-dom -y We will go with the PHP version 7.2 in this guide, again, you can install the PHP version that works best for you.Įxecute the following commands to install PHP-FPM with other PHP extensions on your server. But you can install as many extensions as you want as per your requirements. In this guide or demonstration, we will install only a handful of PHP extensions along with PHP-FPM. Installing PHP is the easiest task from all the tasks we have to perform to set up this stack. Now, we can move on to install PHP on our server. If you see the default Apache page like the following image, you have successfully installed and configured Apache on your server. Once the process is complete, verify the Apache installation by visiting your server’s public IP address on your browser. It might take some time to install Apache and FastCGI on your server. Install Apache with FastCGI on Ubuntu 18.04Įxecute the following commands on your server to install Apache and FastCGI. The first thing we are going to install on our server is, obviously, Apache and Apache’s FastCGI module. I have divided this guide into multiple parts so that you can understand how exactly the stack works. Once you are clear on prerequisites, continue with the guide! Set up Apache with PHP-FPM on Ubuntu 18.04 We also have to create some configuration files to support our stack. We need root access to the server because we have to install Apache, PHP-FPM, FastCGI, and MySQL on our server. Root access to the server OR if you do not have root access, make sure you have sudo privileges.A Clean Ubuntu VPS (No stacks pre-configured).However, there are some prerequisites to follow this guide. One tip, If you are going to host a WordPress website on your server after setting up this stack, use any one of the top WordPress caching plugins to supercharge your WordPress site!įinally, we can start the actual step-by-step tutorial. It will then return the rendered output to the browser. In this stack, Apache will send all the PHP files for processing to FPM. The key ingredient in this stack is FPM which stands for Fast Process Manager. This stack is not as easy as setting up a basic LAMP stack, but it is far better than the basic LAMP stack when it comes to performance. In this guide, I will show you how to set up Apache with PHP FPM on Ubuntu 18.04.Īpache FastCGI with PHP-FPM is one of the best stacks to host PHP applications. It is a well documented and well maintained Linux based operating system for servers. The reason why it is so popular is, it is very easy to get started with. Ubuntu is one of the most used operating systems on the servers that are based on Linux. Ubuntu 18.04 is the latest stable Ubuntu version that we can use on our server. How to set up Apache with PHP-FPM on Ubuntu 18.04
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |