yum -y update
yum -y upgrade
yum install epel-release
yum instll nginx
systemctl start nginx
systemctl enable nginx
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum --disablerepo="*" --enablerepo="remi-safe" list php[7-9][0-9].x86_64
Enable Remi php8.0
yum -y install yum-utils
yum-config-manager --enable remi-php80
install PHP
yum -y install php php-fpm php-mysqlnd php-pgsql php-gd php-imagick php-json php-opcache php-mcrypt php-curl php-mongodb php-mbstring php-intl php-dom php-zip
user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
systemctl start php-fpm
systemctl enable php-fpm
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #경로 변경 시
include fastcgi_params;
}
}
nginx -t # 문법
nginx -s reload #
systemctl restart nginx # 서비스 재시작
ex) localhost/info.php
<?php
echo phpinfo();
?>
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
yum install mariadb-server
systemctl start mariadb
systemctl enable mariadb
sudo mysql_secure_installation or mariadb-secure-installaion
mysqladmin -u root -p {password}
cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/5.0.4/phpMyAdmin-5.0.4-all-languages.zip
unzip phpMyAdmin-5.0.4-all-languages.zip
mv phpMyAdmin-5.0.4-all-languages /usr/share
vim /etc/nginx/conf.d/test.conf
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
location /phpMyAdmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpMyAdmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/phpMyAdmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpmyadmin {
rewrite ^/* /phpMyAdmin last;
}
}
nginx -s reload
session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13)
session_start(): Failed to read session data: files (path: /var/lib/php/session)
Warning in ./libraries/classes/Config.php#1681
mkdir(): Permission denied