RHEL5에 nginx, php5, mysql 설치 Linux2009/11/17 15:45
패키지 설치
php5, mysql 은 OS 시디에 포함된 패키지를 그대로 사용하면 되고 nginx 와 php 연동에 필요한 fastcgi 관련 패키지들은 아래의 사이트에서 별도로 다운받는다.
lighttpd-1.4.18-1.el5.rf.x86_64.rpm
lighttpd-fastcgi-1.4.18-1.el5.rf.x86_64.rpm
http://dag.wieers.com/rpm/packages/lighttpd/
nginx-0.6.39-1.el5.x86_64.rpm
http://rpm.pbone.net/index.php3/stat/4/idpl/12870630/com/nginx-0.6.39-1.el5.x86_64.rpm.html
패키지 설치 후의 설정
/etc/php.ini 에 'cgi.fix_pathinfo = 1' 추가
/etc/rc.local 에 '/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx -g nginx -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid' 추가
/etc/nginx/nginx.conf 내용 수정
# index.php 추가
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
# 아래 부분은 주석 처리 제거하고 수정
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
서비스 시작 및 테스트
# service nginix start
# cat /usr/share/nginx/html/index.php
<? phpinfo() ?>
# 웹브라우저로 접속 확인
