How to install Joomla with LEMP stack on CentOS 7 VPS (Part 2)
Sep 15, 2020
How to installJoomla withLEMP stack onCentOS 7 VPS(Part 2)
WWW.CLOUDMINISTER.COM
Nginx, pronounced as “Engine X” and is a very fast and lightweight web server, that can be
used to support static files, used as a reverse proxy and also for load balancing.
Firstlly, update all the software packages by typing the following command:
# yum -y update
After that install EPEL repository that is required for Nginx packages by using command:
# yum -y install epel-release
Now install Nginx by typing the command:
# yum -y install nginx
After the installation is completed you must Enable and Start Nginx server by typing
command:
# systemctl start nginx
www.cloudminister.com
5. INSTALL NGINX
And enable it with the command: # systemctl enable nginx
Also check its status with # systemctl status nginx
www.cloudminister.com
6.CONFIGURE FIREWALL
AFTER COMPLETED WITH INSTALLATION PART, CONFIGURE THE FIREWALL SETTINGS WITH THE
FOLLOWING COMMAND:
OPEN HTTP PORT BY TYPING COMMAND WITH:
# FIREWALL-CMD –PERMANENT –ZONE=PUBLIC –ADD-SERVICE=HTTP
IF FIREWALLD PACKAGE IS NOT AVAILABLE THEN YOU CAN INSTALL IT WITH COMMAND:
# YUM -Y INSTALL FIREWALLD
AND START FIREWALLD SERVICE WITH COMMAND:
# SYSTEMCTL START FIREWALLD
NOW RELOAD FIREWALL CONFIGURATION FILE BY TYPING:
# FIREWALL-CMD –RELOAD
NOW VERIFY YOUR INSTALLATION OF NGINX BY VISITING THE FOLLOWING URLON ANY BROWSER YOU LIKE WITH HTTP://IP_ADDRESS
www.cloudminister.com
7. CONFIGURE NGINX FILE
www.cloudminister.com
AN NGINX SERVER CONFIGURATION FILE PLAYS AN IMPORTANT ROLE, SO YOU SHOULD BEMORE CAREFUL WHEN SETTING UP THIS FILE.
FOR CONFIGURING NGINX FILE GO INSIDE THE FOLLOWING PATH WITH THE FOLLOWINGCOMMAND:
# CD /ETC/NGINX/CONF.D
# VI DEFAULT.CONF (CREATING NEW FILE)
AND WRITE THE FOLLOWING CODE IN THE ABOVE FILE I.E. DEFAULT.CONF.
ALSO CHANGE YOUR DOMAIN IN PLACE OF IP_ADDRESS
SERVER {
LISTEN 80; SERVER_NAME 3.95.30.147;
root /usr/share/nginx/html/joomla;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
location = /40x.html {
root /usr/share/nginx/html/joomla;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html/joomla;
}
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass unix: /var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; www.cloudminister.com
root /usr/share/nginx/html/joomla;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
location = /40x.html {
root /usr/share/nginx/html/joomla;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html/joomla;
}
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass unix: /var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
www.cloudminister.com } }AND SAVE IT WITH :WQ COMMAND, AFTER THAT EDIT THE CONFIGURATION FILE OFPHP-FPM WITH THE FOLLOWING COMMAND: # vi /etc/php-fpm.d/www.conf
OPEN THE FILE WITH ABOVE COMMAND AND EDIT THE FOLLOWING LINES I.E.
USER = NGINX GROUP = NGINX
ADD NEW LISTEN UNDER LISTEN = 127.0.0.1:9000
LISTEN = /VAR/RUN/PHP-FPM/PHP-FPM.SOCK
AND ALSO ADD
LISTEN.OWNER = NGINX LISTEN.GROUP = NGINX
REMOVE COMMENT (;) FROM THE ABOVE TWO LINES AND SAVE IT WITH :WQ.
WWW.CLOUDMINISTER .COM
8. Install Joomla File
You can easily download Joomla archive file from the link I provided in this blog.
First go inside /tmp directory by typing below command: # cd /usr/share/nginx/html
Make one directory i.e. joomla,
# mkdir joomlaCome inside the joomla directory:
# cd joomla/Download the latest Joomla setup by using wget command: # wget https://downloads.joomla.org/cms/joomla3/3-7-5/Joomla_3-7.5-Stable-Full_Package.zip ?format=zip
And if wget command not work then you can download it with the following command: # yum -y install wget
Now unzip the downloaded file using below command:
# unzip Joomla_3-7.5-Stable-Full_Package.zip
If unzip command is not work then install it first with the following command:
# yum -y install unzip
Also change the ownership of /var/www/html directory by using the following command:
# chown -R nginx: /usr/share/nginx/html
# chmod -R 755 /usr/share/nginx/html
Note: Also change the ownership of group of /var/lib/php/session i.e. by default it is set as apache, sonow change it’s ownership with:
# ls -al /var/lib/php/session (It is used to check the ownership) # chown root:nginx /var/lib/php/session (It is used to change the ownership)
9. Test Joomla
Now for testing the server of Joomla you should restart the server for that follow thecommand:
# nginx -t (If the command shows ‘successfully’ message then the changes in file are correctand else the changes are wrong in the nginx configuration file.)
# systemctl restart php-fpm
# systemctl restart nginx
Then open any browser and type inside URL i.e http://ip_address/
After then configuration page i.e. http://ip_address/installation/ is open and then configurethe following settings
CONCLUSION
AFTER THE ABOVE INSTALLATION, YOU WILL BE ABLE TO
MANAGE YOUR WEBSITE BY JOOMLA CMS IN CENTOS VPS BY
USING NGINX WEB SERVER.