1. centos6.2 최소 설치 ()
  2. 네트워크 설정 vi /etc/sysconfig/network-scripts/ifcfg-eth0 의 ONBOOT 를 yes 로 수정
  3. 필요하다면 selinux 설정 수정 : vi /etc/selinux/config
  4. nginx 의 yum repository 등록
    # cat > /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=
    gpgcheck=0
    enabled=1
    ^D
    #
  5. CentOS 6/5.7 and Red Hat (RHEL) 6.1/6/5.7 Remi repository
    # rpm -Uvh 
    # rpm -Uvh 
    # vi /etc/yum.repos.d/remi.repo # Edit "enabled=1"
    # yum update
  6. MySQL 설치
    # yum install mysql mysql-server
    # /usr/bin/mysql_secure_installation 
    ....
    Set root password? [Y/n] Y
    New password: 

Remove anonymous users? [Y/n] Y ... Success! Disallow root login remotely? [Y/n] Y ... Success! .... Remove test database and access to it? [Y/n] Y

  • Dropping test database... Reload privilege tables now? [Y/n] Y ... Success! ...

    mysqladmin -u root password [password]

    1. nginx + php-fpm 설치
      # yum install nginx php php-fpm php-common php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml
      • 의존성 때문에 httpd 가 설치되니, chkconfig에서 조정 할 필요가 있음
    2. 방화벽firewall 설정
      # vi /etc/sysconfig/iptables
      ## -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 추가
    3. nginx 확인
      # ls -l /usr/share/nginx/html
      total 8
      -rw-r--r-- 1 root root 383 Dec 16 00:26 50x.html
      -rw-r--r-- 1 root root 151 Dec 16 00:26 index.html
      • 웹브라우저로 확인
  1. php-fpm 세팅

    # vi /etc/nginx/conf.d/default.conf
    ## 1) pass the PHP scripts to FastCGI server 항목 주석 해제 
    ## 2) fastcgi_param 수정 
    ...
    location ~ .php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
    
        include        fastcgi_params;
    }
    ...
    # service nginx configtest
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    # service nginx restart 
    Stopping nginx:                                            [  OK  ]
    Starting nginx:                                            [  OK  ]
    # cat > /usr/share/nginx/html/test.php
    <?php phpinfo(); ?>
    ^D
    #
    • 웹브라우저로 확인

Reference

  • 우분투 10.04 LTS, nginx+php-fastcgi+mysql 설치하기 ()
  • Nginx proxy to Apache ()
  • LEMP( Linux + Nginx + Mysql + php) ()
Blog Comments powered by Disqus.

Previous Post Next Post