Thursday, June 30, 2022

How To Install Craft CMS on Rocky Linux 8

 in This Tutorial you will Learn " How To Install Craft CMS on Rocky Linux 8"
Craft CMS is an open source CMS written in PHP. Craft CMS source code is hosted on GitHub.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
dnf install nginx mariadb-server php php-cli php-fpm php-common php-curl php-gd php-json php-mbstring php-mysqli php-pgsql php-zip php-intl php-xml php-pdo -y

nano /etc/php.ini
memory_limit = 256M

nano /etc/php-fpm.d/www.conf
user = nginx
group = nginx
systemctl start nginx mariadb php-fpm ; systemctl enable nginx mariadb php-fpm

mysql
create database craftdb;
grant all on craftdb.* to craftuser@localhost identified by 'securepassword';
flush privileges;
quit;

mysql_secure_installation

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php --install-dir=/usr/local/bin --filename=composer

cd /var/www/html/ ; composer create-project craftcms/craft craft
chown -R nginx:nginx /var/www/html/craft ; chown -R nginx:nginx /var/lib/php/session
nano /etc/nginx/conf.d/craft.conf
server {

  listen 80;
  server_name craft.example.com;
  root /var/www/html/craft/web;
  index index.php;


  location / {
    try_files $uri/index.html $uri $uri/ /index.php?$query_string;
  }

  location ~ [^/]\.php(/|$) {
    try_files $uri $uri/ /index.php?$query_string;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php-fpm/www.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param HTTP_PROXY "";
  }

}
nano /etc/nginx/nginx.conf
server_names_hash_bucket_size 64;
systemctl restart nginx

echo "192.168.1.20 craft.example.com" >> /etc/hosts
firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload  
craft.example.com
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

No comments:

Post a Comment