Install LEMP Stack with MySQL 8 on Fedora 30/Fedora 29

Last Updated:

Learn how to Install LEMP Stack with MySQL 8 on Fedora 30/Fedora 29 by following through this guide.

Installing LEMP Stack with MySQL 8 on Fedora

Run system update;

dnf update
dnf upgrade

Next, install LEMP stack. Installation of different components of LEMP stack (Nginx, MySQL and PHP) have been covered on different guides. See the links below;

Install Nginx Web Server on Fedora 30/Fedora 29

Install MySQL 8 on Fedora 30/Fedora 29

Install PHP 7.3.4 on Fedora 30/Fedora 29

Assuming the above components have been installed, proceed to do the configuration.

Configure PHP

This is a number of PHP extensions that are required for the functionality of Nginx. In our basic setup, this guide installs PHP MySQL native driver and FastCGI Process Manager (php-mysqlnd and php-fpm) extensions.

dnf install php-mysqlnd php-fpm

If your application requires other PHP extensions, you can always install them on Fedora 30/29 by running the command below

dnf install php-[extension]

Next, you need to set the Unix user/group of PHP processes to nginx. This can be done by editing the file, and replacing apache user/group with nginx.

vim /etc/php-fpm.d/www.conf

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

Next, set ownership permissions for unix socket to nginx user/group defined above.

listen.owner = nginx = nginx

Save the configuration file and restart and enable PHP-FPM to run on system boot.

systemctl restart php-fpm
systemctl enable php-fpm

Configuring Nginx

Now that Nginx has been installed, create your site configuration file with the following basic settings.

vim /etc/nginx/conf.d/kifarunix-demo.conf

server {
    listen 80;

    root /usr/share/nginx/html/;
    index index.php;

    access_log /var/log/nginx/;
    error_log /var/log/nginx/;

    location / {
        try_files $uri $uri/ /index.php?$args;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index   index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

Set the bucket size for the types hash tables to 4096.

sed -i 's/types_hash_max_size 2048;/types_hash_max_size 4096;/' /etc/nginx/nginx.conf

Create the web root directory defined above.

mkdir /usr/share/nginx/html/

Save the configuration file and run the command below to verify Nginx syntax.

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx if there is no syntactical error.

systemctl restart nginx

Test Nginx PHP Processing

To confirm that Nginx PHP-FPM is working, create a PHP test page as shown below and test it by accessing it from the browser.

echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/

Now, access the URL Replace your site domain accordingly.

Install LEMP Stack with MySQL 8 on Fedora

Well, seems everything is fine. You can now remove the PHP test page.

rm -rf /usr/share/nginx/html/

That is all on our demo on how to install LEMP Stack with MySQL 8 on Fedora.

Other related tutorials;

Install LAMP Stack on Fedora 30

Install LAMP Stack on Debian 9

How To Install LAMP (Linux, Apache, MySQL, PHP) Stack on Fedora 28/29

How to Install LAMP Stack (Apache,MariaDB, PHP 7.2) on Ubuntu 18.04 LTS

Install phpMyAdmin with Apache on Fedora 30


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Jay Decrame
Linux Certified Engineer, Technology and Linux/Unix enthusiast.

Leave a Comment