How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

January 30, 2020

How to Install PHP-FPM with Apache on Ubuntu 18.04

Filed under: Linux — Tags: , — admin @ 3:33 pm

Common module for php are

apt install php7.1-fpm php7.1-common php7.1-mysql php7.1-xml php7.1-xmlrpc php7.1-curl php7.1-gd php7.1-imagick php7.1-cli php7.1-dev php7.1-imap php7.1-mbstring php7.1-soap php7.1-zip php7.1-bcmath -y

To install apache

apt install apache2

Enable mod proxy

sudo a2enmod proxy_fcgi

A virtual host example

<VirtualHost *:80>
     ServerName External_IP_Address
     DocumentRoot /var/www/html

     <Directory /var/www/html>
          Options Indexes FollowSymLinks
         AllowOverride All
         Require all granted
     </Directory>

     <FilesMatch ".php$"> 
         SetHandler "proxy:unix:/var/run/php/php7.1-fpm.sock|fcgi://localhost/"          
      </FilesMatch>
 
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined  
</VirtualHost> 

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress