<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>How To Install Nginx With PHP-FPM on Ubuntu 20.04 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/how-to-install-nginx-with-php-fpm-on-ubuntu-20-04/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 18 Jun 2020 22:42:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How To Install Nginx With PHP-FPM on Ubuntu 20.04</title>
		<link>https://www.osradar.com/how-to-install-nginx-with-php-fpm-on-ubuntu-20-04/</link>
					<comments>https://www.osradar.com/how-to-install-nginx-with-php-fpm-on-ubuntu-20-04/#respond</comments>
		
		<dc:creator><![CDATA[sabi]]></dc:creator>
		<pubDate>Sun, 21 Jun 2020 02:23:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Focal Fossa]]></category>
		<category><![CDATA[How To Install Nginx With PHP-FPM on Ubuntu 20.04]]></category>
		<category><![CDATA[how to install php fpm services]]></category>
		<category><![CDATA[how to tutorials]]></category>
		<category><![CDATA[Nginx installation]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=20904</guid>

					<description><![CDATA[<p>In this tutorial you are going to learn that how to install nginx with PHP-FPM(FastCGI Process Manager) on Ubuntu 20.04. Nginx is most popular web server having high speed &#38; scalability providing the Reverse Proxy as well as load balancing to various backend servers. The protocols used by the Nginx are HTTP, TCP &#38; UDP. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-nginx-with-php-fpm-on-ubuntu-20-04/">How To Install Nginx With PHP-FPM on Ubuntu 20.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial you are going to learn that <a href="https://www.osradar.com/?p=20904">how to install nginx with PHP-FPM</a>(FastCGI Process Manager) on Ubuntu 20.04. Nginx is most popular web server having high speed &amp; scalability providing the Reverse Proxy as well as load balancing to various backend servers. The protocols used by the Nginx are HTTP, TCP &amp; UDP. Nginx is preffered over Apache as it have the low memory footprint &amp; handle the requests in more easier way. So, let&#8217;s have a short introduction on features of Nginx and then we&#8217;ll move towards the installation of Nginx with PHP-FPM on our Ubuntu 20.04.</p>



<h2>Some Important Features of Nginx</h2>



<ul><li>Content Cache: Cache static &amp; dynamic content</li><li>Load Balancing: HTTP, TCP, &amp; UDP load balancing with Layer 7 request routing using URI, cookie, args, and more.</li><li>Reverse proxy multiple protocols: HTTP, gRPC, memcached, PHP‑FPM, SCGI, uwsgi</li><li>Handle hundreds of thousands of clients at the same time</li><li>Stream HTTP video, FLV, HDS, HLS, MP4</li><li>HTTP/2 gateway with HTTP/2 server push support</li><li>Dual‑stack RSA/ECC SSL/TLS offload</li><li>Monitoring plugins: AppDynamics, Datadog, Dynatrace plug‑ins</li></ul>



<p>So, follow the below steps for an easy installation.</p>



<h3><strong>Step 1: Update &amp; Upgrade Your System</strong></h3>



<p>Fire the below command in your terminal to fetch the latest updates before going to install Nginx with PHP-FPM on Ubuntu 20.04</p>



<pre class="wp-block-verse">sudo apt update &amp; sudo apt upgrade</pre>



<h3><strong>Step 2: Installing Nginx on Ubuntu 20.04</strong></h3>



<p>Once the system is updated, run the given command to install the Nginx on Ubutnu 20.04.</p>



<pre class="wp-block-verse">sudo apt install nginx</pre>



<p>Verify the installation by running</p>



<pre class="wp-block-verse">sudo systemctl status nginx</pre>



<p>Output:</p>



<pre class="wp-block-verse">sabir@Ubuntu20:~$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset&gt;
Active: active (running) since Thu 2020-06-18 07:18:21 PKT; 3s ago
Docs: man:nginx(8)
Process: 14321 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_pro&gt;
Process: 14322 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; &gt;
Main PID: 14323 (nginx)
Tasks: 2 (limit: 1078)
Memory: 4.2M
CGroup: /system.slice/nginx.service
├─14323 nginx: master process /usr/sbin/nginx -g daemon on; maste&gt;
└─14324 nginx: worker process
جون 18 07:18:21 Ubuntu20 systemd[1]: Starting A high performance web server an&gt;
جون 18 07:18:21 Ubuntu20 systemd[1]: Started A high performance web server and&gt;
lines 1-15/15 (END)</pre>



<p>As you&#8217;ve to select once server Apache or Nginx. So, to use Nginx either you&#8217;ve to change the Port or disable the Apache web server. To disable Apache, run the below command.</p>



<pre class="wp-block-verse">sudo systemctl disable --now apache2</pre>



<p>And then allow the firewall access on port 80.</p>



<pre class="wp-block-verse">sudo ufw allow proto tcp from any to any port 80,443</pre>



<h3><strong>Step 3: Installing PHP-FPM</strong></h3>



<p>Now, as we&#8217;ve already installed Nginx. To use PHP with Nginx fire the below command.</p>



<pre class="wp-block-verse">sudo apt update<br>sudo apt install php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath</pre>



<p>Once the installation finished, verify the status of PHP-FPM services by running the below command.</p>



<pre class="wp-block-verse">sudo systemctl status php7.4-fpm.service</pre>



<p>Output:</p>



<pre class="wp-block-verse">sabir@Ubuntu20:~$ sudo systemctl status php7.4-fpm.service
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor p&gt;
Active: active (running) since Thu 2020-06-18 07:20:10 PKT; 10s ago
Docs: man:php-fpm7.4(8)
Process: 18829 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /r&gt;
Main PID: 18815 (php-fpm7.4)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0re&gt;
Tasks: 3 (limit: 1078)
Memory: 11.1M
CGroup: /system.slice/php7.4-fpm.service
├─18815 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
├─18827 php-fpm: pool www
└─18828 php-fpm: pool www
جون 18 07:20:10 Ubuntu20 systemd[1]: Starting The PHP 7.4 FastCGI Process Mana&gt;
جون 18 07:20:10 Ubuntu20 systemd[1]: Started The PHP 7.4 FastCGI Process Manag&gt;
lines 1-16/16 (END)</pre>



<p>You can find the PID &amp; Socket files under the directory.</p>



<pre class="wp-block-verse">sabir@Ubuntu20:~$ ls /run/php/
php7.4-fpm.pid php7.4-fpm.sock php-fpm.sock</pre>



<h3><strong>Step 4: Configuring PHP-FPM with Nginx On Ubutnu 20.04</strong></h3>



<p>Now, to configure PHP-FPM with Nginx edit your application Nginx config file &amp; set fastcgi_pass section to load through the FPM socket. Look at the below snippet.</p>



<pre class="wp-block-verse">$ cat /etc/nginx/php_fastcgi.conf
#404
try_files $fastcgi_script_name =404;
default fastcgi_params
include fastcgi_params;
fastcgi settings
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_hide_header X-Powered-By;
fastcgi_hide_header X-CF-Powered-By;</pre>



<p>After it reload the Nginx &amp; open your applications on the web to make sure they are working as expected. So, this is how you can install Nginx web server with PHP-FPM on Ubutnu 20.04.</p>



<p>So, hare this post and join <a href="https://t.me/osradar" target="_blank" rel="noreferrer noopener">our Telegram Channel</a>. Also, buy us a coffee.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-nginx-with-php-fpm-on-ubuntu-20-04/">How To Install Nginx With PHP-FPM on Ubuntu 20.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-nginx-with-php-fpm-on-ubuntu-20-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
