CentOS 7에 php7+Codeigniter(ciboard)+nginx 설치하기

  • ISO 파일 다운로드

http://ftp.daumkakao.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso

  • MariaDB 설치

    • 어플 설치
      $ sudo yum install -y mariadb mariadb-server
    • MariaDB 실행
      $ sudo systemctl start mariadb
      
    • DB 초기 설정
      $ sudo mysql_secure_installation
      mysql_secure_installation prompts:
      Enter current password for root (enter for none):
      OK, successfully used password, moving on...
      
      Setting the root password ensures that nobody can log into the MariaDB
      root user without the proper authorisation.
      
      New password: password
      Re-enter new password: password
      Password updated successfully!
      Reloading privilege tables..
       ... Success!
      
    • mariaDB 서비스 등록
      $ sudo systemctl enable mariadb
    • db 인코딩 설정
        • client side
      $ sudo vi /etc/my.cnf.d/client.cnf
      [client]
      default-character-set=utf8
        • server side
      $ sudo vi /etc/my.cnf.d/server.cnf
      [mysqld]
      collation-server = utf8_unicode_ci
      init-connect='SET NAMES utf8'
      character-set-server = utf8
        • 재실행
      $ sudo systemctl restart mariadb
  • Nginx 설치

      • 저장소 설치
    $ sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    
    
      • nginx 설치
    $ sudo yum install nginx
      • nginx 실행 및 서비스 등록
    $ sudo systemctl start nginx
    $ sudo systemctl enable nginx
  • PHP 7 설치

    yum install -y epel-release
    rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    yum --enablerepo=remi update remi-release
    yum --enablerepo=remi-php70 install -y php php-fpm php-mysql php-gd php-common php-cli php-json php-opcache php-devel php-imagick
      • php 설정
    $ sudo vi /etc/php.ini
    
    cgi.fix_pathinfo=0
      •  php fpm 설정
    $ sudo vi /etc/php-fpm.d/www.conf
    listen = /var/run/php-fpm/php-fpm.sock
    
    listen.owner = nginx
    listen.group = nginx
    
    user = nginx
    group = nginx
    
  • Nginx 설정

    $  sudo vi /etc/nginx/nginx.conf
    server {
     listen 80 default_server;
     listen [::]:80 default_server;
     server_name server_domain_name_or_IP;
     root /usr/share/nginx/html;
     index index.php index.html;
    
     # Load configuration files for the default server block.
     include /etc/nginx/default.d/*.conf;
    
     location / {
       try_files $uri $uri/ /index.php?/$request_uri;
     }
    
     error_page 404 /404.html;
     location = /40x.html {
     }
    
     error_page 500 502 503 504 /50x.html;
     location = /50x.html {
     }
    
     location ~ .php$ {
       fastcgi_split_path_info ^(.+.php)(/.+)$;
       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 ~ /.ht {
       deny all;
     }
    }
      • Nginx 재실행
    $ sudo systemctl restart nginx

 

결과화면

설치 결과화면
결과화면

 

 

Author :
github: https://github.com/9to6

카테고리

Count per Day

  • 25417Total visitors:
  • 3Visitors today:
  • 60Visitors yesterday:
  • 429Visitors last week:
  • 61Visitors per day:
  • 2017년 4월 7일Counter starts on: