<?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>LEMP &#8211; TECH POINT MAGAZINE</title>
	<atom:link href="https://techpointmag.com/tag/lemp/feed/" rel="self" type="application/rss+xml" />
	<link>https://techpointmag.com</link>
	<description>-Beyond Technology-</description>
	<lastBuildDate>Mon, 20 Feb 2023 13:33:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://techpointmag.com/wp-content/uploads/2019/06/cropped-tech-point-logo@2x-3-32x32.png</url>
	<title>LEMP &#8211; TECH POINT MAGAZINE</title>
	<link>https://techpointmag.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">141627558</site>	<item>
		<title>How to Install LEMP (Linux, Nginx, MySQL, PHP) Stack on CentOS 8, AlmaLinux, RockyLinux 8</title>
		<link>https://techpointmag.com/install-a-lemp-stack-on-centos-alma-linux-rocky/</link>
		
		<dc:creator><![CDATA[Humphrey Mpairwe]]></dc:creator>
		<pubDate>Mon, 20 Feb 2023 13:33:50 +0000</pubDate>
				<category><![CDATA[Guides]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Cent OS]]></category>
		<category><![CDATA[LEMP]]></category>
		<category><![CDATA[LEMP Stack]]></category>
		<guid isPermaLink="false">https://techpointmag.com/?p=14961</guid>

					<description><![CDATA[The LEMP Stack is a suite of software that makes it possible to serve dynamic web pages and applications hosted on your server. LEMP is an acronym that describes Linux, Nginx (sounding as Engine X), MySQL, PHP/Python/Perl, a combination that makes it easy to store data, and serve dynamically processed data on your server. In [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>The LEMP Stack is a suite of software that makes it possible to serve dynamic web pages and applications hosted on your server. LEMP is an acronym that describes Linux, Nginx (sounding as Engine X), MySQL, PHP/Python/Perl, a combination that makes it easy to store data, and serve dynamically processed data on your server.</p>



<p>In this guide, we’ll install the LEMP Stack on a CentOS 8 server. The stack requires a fresh server instance and a sudo user account to facilitate the installation of all software packages.</p>



<h3 class="wp-block-heading">Prerequistes</h3>



<p>Before you follow this guide, please make sure you have.</p>



<ul class="wp-block-list"><li>A CentOS 8 Server</li><li>A non-root user account with sudo privileges (root access rights)</li><li>SSH access to the server</li></ul>



<h2 class="wp-block-heading">Step 1: Install Nginx</h2>



<p>In order for the server to display web pages to visitors, we need to install Nginx which can be configured to serve static and dynamic websites. By default, Nginx is available in the CentOS 8 sources.</p>



<p><strong>Install Nginx.</strong></p>



<p><code>$ sudo dnf install nginx</code></p>



<p>Once installed, Allow http and https traffic to the server for Nginx to operate well.</p>



<p><code>$ sudo firewall-cmd --permanent --zone=public --add-service=http</code><br><code>$ sudo firewall-cmd --permanent --zone=public --add-service=https</code></p>



<p>Restart the Firewall for rules to take effect.<br><br><code>$ sudo systemctl reload firewalld</code></p>



<p>Now, start the Nginx web server and enable it to run at system boot.</p>



<p><code>$ systemctl start nginx</code></p>



<p>In a web browser, visit your public server IP address or domain name to confirm your nginx installation. Your output should be similar to the one below.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://techpointmag.com/wp-content/uploads/2021/10/Nginx-on-CentOS-8.jpg"><img fetchpriority="high" decoding="async" width="750" height="500" src="https://techpointmag.com/wp-content/uploads/2021/10/Nginx-on-CentOS-8.jpg" alt="Install LEMP Stack on CentOS 8" class="wp-image-14966" srcset="https://techpointmag.com/wp-content/uploads/2021/10/Nginx-on-CentOS-8.jpg 750w, https://techpointmag.com/wp-content/uploads/2021/10/Nginx-on-CentOS-8-300x200.jpg 300w, https://techpointmag.com/wp-content/uploads/2021/10/Nginx-on-CentOS-8-450x300.jpg 450w" sizes="(max-width: 750px) 100vw, 750px" /></a></figure></div>


<h2 class="wp-block-heading">Step 2: Install MySQL</h2>



<p>With a web server installed on your server, you need a database server to be able to store data for your websites. By default, MySQL 8.0 is available on the CentOS 8 repository packages list and can be identified by mysql_server.</p>



<p><code>$ sudo dnf install mysql-server</code></p>



<p>With installation done, start the MySQL daemon and enable it to run at system startup.</p>



<p><code>$ sudo systemctl start mysqld</code></p>



<p>Now, secure your database server by setting a root password</p>



<p><code>$ sudo mysql_secure_installation</code></p>



<p>Next, test the Installation by creating a sample database and user for your server.</p>



<p><strong>Login to MySQL.</strong></p>



<p><code>$ mysql -u root -p</code></p>



<p><strong>Create a new database.</strong></p>



<p><code>mysql > CREATE DATABASE sampledb;</code></p>



<p><strong>Create a new database user</strong></p>



<p><code>mysql > CREATE USER ‘user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';</code></p>



<p><strong>Exit the console</strong></p>



<p><code>mysql > EXIT</code></p>



<p>You can now login to MySQL with the created non-root user to create databases.</p>



<p><code>$ mysql -u user -p</code></p>



<h2 class="wp-block-heading">Step 3: Install PHP</h2>



<p>With a web and database server installed, you need a dynamic data processor to serve web content and PHP is the best component to install. Also the php-mysqlnd allows PHP to communicate with MySQL databases and php-fpm makes connections with Nginx possible.</p>



<p><strong>Install PHP and necessary modules</strong></p>



<p><code>$ sudo dnf install php php-mysqlnd php-fpm</code></p>



<p>Now, modify the PHP-FPM main configuration file to listen for the user nginx.</p>



<p>In your favorite editor, open and edit `/etc/php-fpm.d/www.conf`.</p>



<p><code>$ sudo nano /etc/php-fpm.d/www.conf</code></p>



<p><strong>Locate the user and group entries.</strong></p>



<pre class="wp-block-preformatted"><code>user = apache ;</code></pre>



<pre class="wp-block-preformatted"><code> RPM: Keep a group allowed to write in log dir. </code></pre>



<pre class="wp-block-preformatted"><code>group = apache</code></pre>



<p>Change them to `nginx`.</p>



<pre class="wp-block-preformatted"><code>user = nginx</code></pre>



<pre class="wp-block-preformatted"><code>; RPM: Keep a group allowed to write in log dir.</code></pre>



<pre class="wp-block-preformatted"><code>group = nginx</code></pre>



<p>Save and close the file.</p>



<p><strong>Restart PHP-FPM and Nginx.</strong></p>



<p><code>$ sudo systemctl restart php-fpm</code></p>



<p><code>$ sudo systemctl restart nginx</code></p>



<h2 class="wp-block-heading">Step 4: Test PHP with Nginx</h2>



<p>On CentOS 8, Nginx stores web server files at `/usr/share/nginx/html`, let’s create a sample `info.php` file at the directory.</p>



<p><code>$ sudo nano /usr/share/nginx/html/info.php</code></p>



<p>Enter the following code</p>



<pre class="wp-block-preformatted">&lt;? 

phpinfo();

?></pre>



<p>Now, In a web browser, load your server IP or domain name and add <code>/info.php</code> to load the file. You output should be similar to the one below.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://techpointmag.com/wp-content/uploads/2021/10/Checking-PHP-Version.jpg"><img decoding="async" width="750" height="500" src="https://techpointmag.com/wp-content/uploads/2021/10/Checking-PHP-Version.jpg" alt="Checking PHP Version on CentOS 8" class="wp-image-14965" srcset="https://techpointmag.com/wp-content/uploads/2021/10/Checking-PHP-Version.jpg 750w, https://techpointmag.com/wp-content/uploads/2021/10/Checking-PHP-Version-300x200.jpg 300w, https://techpointmag.com/wp-content/uploads/2021/10/Checking-PHP-Version-450x300.jpg 450w" sizes="(max-width: 750px) 100vw, 750px" /></a></figure></div>]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">14961</post-id>	</item>
	</channel>
</rss>
