User Tools

Site Tools


create_a_lemp_server_running_litecart

How to Create a LEMP Server Running LiteCart

  1. Download CentOS from the CentOS Project website.
  2. Burn a disc from the ISO file. And boot up your machine using the disc. See YouTube for guides how to install CentOS.
  3. After install. Login as root and proceed with the commands below.

Install Services

lemp_install.sh
#!/bin/sh
 
# Install some repositories
yum localinstall https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum localinstall http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
 
## Install some tools
yum install -y lynx nano unzip wget
 
## Install NGINX (See below)
yum install -y nginx
 
## Install MySQL
yum --enablerepo=mysql57-community install -y mysql-community-server
 
## Install PHP and PHP-FPM
yum --enablerepo=remi-php72 install -y php php-fpm php-bcmath php-gd php-mbstring php-mysqlnd php-mcrypt php-soap php-zip
 
### Configurations #############
 
## Configure MySQL
# If you missed your temporary password do: grep 'temporary password' /var/log/mysqld.log
mysql_secure_installation
 
## Configure PHP-FPM (see below)
nano /etc/php-fpm.d/www.conf
 
## Configure services to start upon boot sequence
systemctl enable nginx
systemctl enable mysqld
systemctl enable php-fpm
 
## Starts services immediately
systemctl start nginx
systemctl start mysqld
systemctl start php-fpm
 
## Create index.php (echo hello world or phpinfo())
echo "<?php echo 'Hello World'; ?>" > /var/www/litecart/index.php
 
# Open the browser and make sure you see Hello World
lynx http://localhost/
 
## Allow incoming connections on port 80 from other computers
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

Install LiteCart

wget -O litecart.zip https://github.com/litecart/litecart/archive/master.zip
unzip litecart.zip litecart-master/public_html/* -d /var/www/litecart
mv /var/www/litecart/litecart-master/public_html/* /var/www/litecart/
rm -rf /var/www/litecart/litecart-master
 
## Add host
echo "127.0.0.1    litecart" >> /etc/hosts
 
## Configure NGINX (See below)
nano /etc/nginx/conf.d/litecart.conf
 
## Create a MySQL Database (Use your mysql root password)
mysql -uroot -p -e "CREATE DATABASE litecart; CREATE USER litecart@localhost IDENTIFIED BY 'test123test%'; GRANT ALL ON litecart.* TO litecart@localhost;"
 
# Restart NGINX
systemctl start nginx
 
## Go to http://litecart/install to complete installation
lynx http://litecart/install

Configurations

/etc/nginx/conf.d/litecart.conf
server {
  server_name litecart;
  listen      80;
 
  root        /var/www/litecart;
  index       index.php index.html index.htm;
 
  error_page 401 "Access Forbidden";
  error_page 403 /error_document?code=403;
  error_page 404 /error_document?code=404;
  error_page 410 /error_document?code=410;
  error_page 500 "Internal Server Error";
 
  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }
 
  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}
/etc/php.ini
...
cgi.fix_pathinfo=0
...
/etc/php-fpm.d/www.conf
listen = 127.0.0.1:9000
listen.owner = nobody
listen.group = nobody
user = nginx
group = nginx

Install Ajenti Control Panel

http://support.ajenti.org/forums/5-kb/topics/1122-installing-on-centosrhel/

# Install repository
yum localinstall http://repo.ajenti.org/ajenti-repo-1.0-1.noarch.rpm
 
## Install Ajenti
yum --enablerepo=ajenti install -y ajenti
 
## Allow incoming connections on port 8000 from other computers
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --reload

Install a DNS Server

## Install DNS server
yum install -y bind bind-utils
 
## Configure to start upon boot sequence
systemctl enable named
 
## Start immediately
systemctl start named
create_a_lemp_server_running_litecart.txt · Last modified: 2018/01/13 02:41 by admin