Install LEMP Stack (Nginx, MariaDB, php, phpMyAdmin) on Arch Linux & Manjaro

5a) changes on php.ini Configuration

Edit the /etc/php/php.ini configuration file and un-comment or modify below listed lines which is necessary to run LAMP without issue.

$ sudo nano /etc/php/php.ini

[Set your timezone]
date.timezone = Asia/Kolkata

[Display errors to debug your PHP code]
display_errors = On

[For php-gd extensions]
extension=gd.so

[Configure MySQL/MariaDB extensions]
extension=pdo_mysql.so
extension=mysqli.so

[bzip2 extensions]
extension=bz2.so

[mcrypt php extensions]
extension=mcrypt.so

6) Nginx Configuration

Open /etc/nginx/nginx.conf file on your favorite text editor and change worker_processes values according your CPU count. For CPU count use lscpu command. I’m having 4 CPU’s that’s why i added 4. Also check Nginx User, it should be http. We need to tell nginx to run php using php-fpm. Also add/modify below colored lines on your file. I have removed all the unwanted lines from this file for clear explanation. Mention your FQDN (server.2daygeek.com) instead of us.

$ nano /etc/nginx/nginx.conf

worker_processes 4;

server_name manjaro.2daygeek.com;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm index.php;


location ~ \.php$ {
      fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
      fastcgi_index  index.php;
      root   /usr/share/nginx/html;
      include        fastcgi.conf;
 }                                                                    

Create test php file to check whether php is working with apache or not.

[Creating php info file]
$ sudo nano /usr/share/nginx/html/phpinfo.php
<?php phpinfo(); ?>

[Restart Nginx service]
$ sudo systemctl restart nginx.service

[Restart php-fpm service]
$ sudo systemctl restart php-fpm

Run nginx configuration test

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

Open your web browser and navigate to http://localhost/phpinfo.php or http://your-server-ip-address/phpinfo.php or http://127.0.0.1/phpinfo.php
install-lemp-server-on-arch-linux-manjaro-3

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *