Rocky Linux 8.5 에서 Lighttpd + PHP + MariaDB 설치하기

리눅스/APACHE|2022. 5. 24. 13:41
반응형

1. 패키지 저장소 추가 및 최신화

# yum -y install epel-release
# yum -y update

 

 

2. Lighttpd 설치

# yum install lighttpd
# systemctl start lighttpd
# systemctl enable lighttpd

 

 

3. MariaDB 설치

# yum -y install mariadb mariadb-server
# systemctl start mariadb
# systemctl enable mariadb
# mysql_secure_installation

(모든 선택은 'Y' 로 하고 root 패스워드만 수동 입력)

 

 

4. PHP 설치

# yum -y install php php-mysqlnd php-pdo php-gd php-mbstring php-fpm lighttpd-fastcgi

# systemctl start php-fpm

# systemctl enable php-fpm

 

 

5. 설정 및 적용

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

user = lighttpd
group = lighttpd
listen = 127.0.0.1:9000

# vi /etc/php.ini

cgi.fix_pathinfo=1

# vi /etc/lighttpd/modules.conf

include "conf.d/fastcgi.conf"

# vi /etc/lighttpd/conf.d/fastcgi.conf

fastcgi.server += ( ".php" =>
        ((
                "host" => "127.0.0.1",
                "port" => "9000",
                "broken-scriptfilename" => "enable"
        ))
)

 

# systemctl restart php-fpm

# systemctl restart lighttpd

 

 

6. 확인

지금까지 설치했던 데몬의 상태는 아래와 같이 확인이 가능합니다.

# systemctl status lighttpd

# systemctl status php-fpm

# systemctl status mariadb

 

이제 php 소스가 정상 출력 되는지 브라우저를 통해 확인해봅니다.

http://sysdocu.tistory.com/phpinfo.php

 

 

* php 페이지 접근이 안될 경우 확인 사항

1) 내부 방화벽 (firewall, ufw, iptables, tcp wrapper 등 80번 포트 접근 허용)

2) selinux 설정 (setenforce 0 으로 해제 또는 /etc/selinux/config 수정)

 

 

반응형

댓글()