How to Create a LEMP Server Running LiteCart
-
Download CentOS from the CentOS Project website.
-
Burn a disc from the ISO file. And boot up your machine using the disc. See YouTube for guides how to install CentOS.
-
After install. Login as root and proceed with the commands below.
Install Services
#!/bin/sh
# Install some repositories
yum localinstall https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum localinstall https://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
#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
# 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 hostname to hosts
echo "127.0.0.1 litecart.local" >> /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 https://litecart/install to complete installation
lynx https://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
https://docs.ajenti.org/en/latest/man/install.html#installing
# Install Ajenti
curl https://raw.githubusercontent.com/ajenti/ajenti/master/scripts/install.sh | sudo bash -s -
# 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
See Also
Révisions
Meilleurs éditeurs
Articles récemment édités