원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어

Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

 

 

* 설치환경

- OS : Rockay Linux 9.1

- Webserver : nginx 1.20

- PHP : php 8

- DBMS : MariaDB 10.5

- nginx root directory : /data/www

- nginx to php-fpm 통신방식 : TCP

 

 

 

1. php, nginx 설치

 

# yum install php php-common php-xml php-pdo php-opcache php-mbstring php-cli php-fpm php-gd php-mysqlnd

php-common-8.0.30-1.el9_2.x86_64
php-xml-8.0.30-1.el9_2.x86_64
php-pdo-8.0.30-1.el9_2.x86_64
php-opcache-8.0.30-1.el9_2.x86_64
php-mbstring-8.0.30-1.el9_2.x86_64
php-cli-8.0.30-1.el9_2.x86_64
php-fpm-8.0.30-1.el9_2.x86_64
php-8.0.30-1.el9_2.x86_64
php-gd-8.0.30-1.el9_2.x86_64
php-mysqlnd-8.0.30-1.el9_2.x86_64


# yum install nginx

nginx-filesystem-1.20.1-14.el9_2.1.noarch
pcp-pmda-nginx-6.0.5-4.el9.x86_64
nginx-core-1.20.1-14.el9_2.1.x86_64
nginx-1.20.1-14.el9_2.1.x86_64
 

 

2. MariaDB 10.5 설치하기

# yum install mariadb mariadb-server 

mariadb-connector-c-config-3.2.6-1.el9_0.noarch
mariadb-connector-c-3.2.6-1.el9_0.x86_64
mariadb-common-10.5.22-1.el9_2.x86_64
mariadb-10.5.22-1.el9_2.x86_64
mariadb-errmsg-10.5.22-1.el9_2.x86_64
mariadb-server-utils-10.5.22-1.el9_2.x86_64
mariadb-gssapi-server-10.5.22-1.el9_2.x86_64
mariadb-backup-10.5.22-1.el9_2.x86_64
mariadb-server-10.5.22-1.el9_2.x86_64
 

 

3. php 환경설정

 

# vi /etc/php-fpm.d/www.conf

user = nginx
group = nginx
listen = 127.0.0.1:9000
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18


# vi /etc/php.ini
memory_limit = 1024M
post_max_size = 2048M
upload_max_filesize = 2048M


 

 

4. nginx 설정

# vi /etc/nginx/nginx.conf

    server {
        listen       80;
        listen       [::]:80;
        server_name  _;
        #server_name  localhost;
        #root         /usr/share/nginx/html;
        root         /data/www/;

        # Add index.php
        index index.php index.html index.htm;


        # Log files
        access_log  /var/log/nginx/access.log  main;
        error_log   /var/log/nginx/error.log;

        # Location
        location / {
                        try_files $uri $uri/ /index.php?$args;
                }

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;


        error_page 404 /404.html;
        location = /404.html {
        }
        
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

# vi /etc/nginx/conf.d/php-fpm.conf
# PHP-FPM FastCGI server
# network or unix domain socket configuration

upstream www {
        server 127.0.0.1:9000;
}


# vi /etc/nginx/default/php.conf
index index.php index.html index.htm;

location ~ \.(php|phar)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;

    fastcgi_intercept_errors on;
    fastcgi_index  index.php;
    include        fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  PATH_INFO $fastcgi_path_info;
        fastcgi_pass   127.0.0.1:9000;
}
 

 

5. php-fpm, nginx 재기동

# service php-fpm restart
# service nginx restart

 

 

6. MariaDB 설정


# mysql -uroot -p mysql
[mysql] set password=password('newpassword');
[mysql] create database dbname;
[mysql] create user username@'%' identified by 'userpassword';
[mysql] grant all privileges on dbname.* to username@'%';
[mysql] flush privileges;

 

 

7. Wordpress 다운로드 및 설치

 

# cd /data
# wget https://ko.wordpress.org/latest-ko_KR.zip
# unzip latest-ko_KR.zip
# mv wordpress www

 

 

8. 초기 구성페이지 로드

 

http://yourIP

 

 

 

 

 

 

 

서버에 요청 중입니다. 잠시만 기다려 주십시오...