Linux serverNETWORK ADMINISTRATIONS

Install Laravel with Nginx and PHP on CentOS 7 with Google Cloud – Cài PHP với Nginx trên CentOS 7

P.1

step 1 : install pass for root — sudo passwd

— sudo yum install nano -y
— sudo yum -y install unzip

Mở file sshd_config
— sudo nano /etc/ssh/sshd_config
Chỉnh sửa hai dòng:
PermitRootLogin no thành PermitRootLogin yes
PasswordAuthentication no thành PasswordAuthentication yes
Nhấn tổ hợp phím Ctrl + O để lưu.
Nhấn tổ hợp phím Ctrl + X để đóng cửa sổ chỉnh sửa sshd_config

step 2 : install nginx

— yum -y install epel-release
— yum -y install nginx

— systemctl start nginx
— systemctl enable nginx
— netstat -plntu
— yum -y install net-tools

step 3 : Cài đặt php PHP-FPM 7.4

— sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

— sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

— sudo yum -y install yum-utils
— sudo yum-config-manager –enable remi-php74
— sudo yum update
— sudo yum install php php-cli
— sudo yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

— php -v

— nano /etc/php.ini
change : cgi.fix_pathinfo=0

— nano /etc/php-fpm.d/www.conf

change :

user = nginx
group = nginx

listen = /run/php-fpm/php-fpm.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

— systemctl start php-fpm
— systemctl enable php-fpm

— netstat -pl | grep php-fpm.sock
step 4 : Install MariaDB Server
— yum -y install mariadb mariadb-server
— systemctl start mariadb
— systemctl enable mariadb
— netstat -plntu
mysql_secure_installation

Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Step 5 – Install PHP Composer
— curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/bin –filename=composer
— composer

source

centos 7

Leave a Reply

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