Difference between revisions of "Installing The LAMP Stack On A Server"

From Nick's Personal Wiki
Jump to navigation Jump to search
(Initial content commit, through configuring Apache)
Line 17: Line 17:
  
  
== Installing Apache ==
+
== Apache ==
  
 +
=== Installing Apache ===
 +
Install Apache using the command below:
 +
<nowiki>sudo dnf install httpd</nowiki>
  
== Installing MariaDB ==
+
Enable the Apache service, httpd.service, to start at boot:
 +
<nowiki>sudo systemctl start httpd.service</nowiki>
 +
<nowiki>sudo systemctl enable httpd.service</nowiki>
  
 +
Check that the service has been started and is enabled:
 +
<nowiki>sudo systemctl status httpd.service</nowiki>
  
== Installing PHP ==
+
=== Configuring Apache ===
 +
Create an Apache config file, httpd-mpm.conf, using the template provided below. These are settings typical for use on a smaller cloud server running on something like Linode, DigitalOcean, AWS, or Azure:
 +
<nowiki>nano httpd-mpm.conf</nowiki>
 +
 
 +
Inside httpd-mpm.conf, place the following -- adjust as needed for use-case:
 +
<nowiki>KeepAlive Off
 +
 
 +
<IfModule prefork.c>
 +
    StartServers        4
 +
    MinSpareServers    20
 +
    MaxSpareServers    40
 +
    MaxClients          200
 +
    MaxRequestsPerChild 4500
 +
</IfModule></nowiki>
 +
 
 +
== MariaDB ==
 +
 
 +
 
 +
== PHP ==

Revision as of 11:10, 21 December 2023

LAMP Stack refers to the following software tools all running on the same server together:

L - Linux

A - Apache (replaceable with Nginx)

M - MySQL or MariaDB (replaceable with other database tools)

P - PHP or Python

For this page, Linux, Apache, MariaDB, and PHP will be used.


Prerequisites

Ensure that you have created, configured, and secured a remote server at least at a basic level and that all the software packages installed are up to date. A Wiki page to do so can be found here.


Apache

Installing Apache

Install Apache using the command below:

sudo dnf install httpd

Enable the Apache service, httpd.service, to start at boot:

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Check that the service has been started and is enabled:

sudo systemctl status httpd.service

Configuring Apache

Create an Apache config file, httpd-mpm.conf, using the template provided below. These are settings typical for use on a smaller cloud server running on something like Linode, DigitalOcean, AWS, or Azure:

nano httpd-mpm.conf

Inside httpd-mpm.conf, place the following -- adjust as needed for use-case:

KeepAlive Off

<IfModule prefork.c>
    StartServers        4
    MinSpareServers     20
    MaxSpareServers     40
    MaxClients          200
    MaxRequestsPerChild 4500
</IfModule>

MariaDB

PHP