CentOS7, nginx에서 drupal설치하기
"Drupal 설치하기"
------------------------------------------------------------------------------------------------------------------
* 테스트 환경
- CentOS7 + Nginx 1.12.0 + Php7 + MariaDB 10.1 + Drupal 8.3.1
- nginx 설치: http://jehna.tistory.com/17
- php7 설치 및 nginx 연동: http://jehna.tistory.com/18
- mariDB 설치: http://jehna.tistory.com/21
------------------------------------------------------------------------------------------------------------------
1. Drupal8 다운로드
Drupal 8.3.1: https://www.drupal.org/project/drupal/releases/8.3.1
2. 다운로드 파일 이동 및 압축 해제
# pwd /usr/share/nginx/html # tar xvzf drupal-8.3.1.tar # mv drupal-8.3.1 drupal // 이름 변경 |
3. drupal 설치 준비
1) setting.php 파일 생성 및 권한 변경
# cd /usr/share/nginx/html/drupal/sites/default # cp default.settings.php settings.php # chmod 777 settings.php |
2) 한국어 설치를 위한 폴더 생성
# pwd /usr/share/nginx/html/drupal/sites/default/ # mkdir -p files/translations # chmod 777 files |
3) 한국어 언어 패키지 다운로드
https://localize.drupal.org/download?project=drupal
- korean 에서 8.x 다운로드
4) 언어패키지 파일 translations 디렉토리로 이동
# cd /usr/share/nginx/html/drupal/sites/default/files/translations # ls drupal-8.3.2.ko.po |
※ drupal 설치 후 files 디렉토리와 setting.php파일 권한은 변경해주세요! (보안상 위험해요)
4. php 모듈 확인 및 설치
- php71u-opcache, php71u-json 모듈 필요
# ls /usr/lib64/php/modules // 모듈 확인 # yum install php71u-json // 없는 모듈 설치 |
5. drupal.conf 파일 생성
- conf파일 내용 복사: https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
- 아래 내용은 수정할 부분만 표시함. 위 url에서 파일 내용을 복사해서 수정하면 됨
# vim /etc/ngnix/conf.d/drupal.conf server { server_name 192.168.0.111; root /usr/share/nginx/html/drupal; ## <-- Your only path reference. .... .... .... # PHP 5 socket location. #fastcgi_pass unix:/var/run/php5-fpm.sock; # PHP 7 socket location. fastcgi_pass php-fpm; } |
6. 기존 nginx 설정 파일 삭제 또는 이름 변경
- 기존에 동작하던 default.conf파일과 drupal.conf파일이 겹치기 때문에 둘중 하나만 사용해야 함
(두개다 사용할 경우 default.conf파일이 우선적으로 적용되기 때문에 drupal설치가 안되요!)
# cd /etc/nginx/conf.d # mv default.conf default.conf_ // 혹시몰라서 이름만 변경 |
7. nginx, php-fpm 재시작
# systemctl restart nginx # systemctl restart php-fpm |
8. drupal 설치 전 DB, user 생성
- drupal에서 사용할 데이터베이스와 사용자를 미리 생성해야 함 (그래야 막힘없이 설치할 수 있어요!)
# mysql -u root -p // DB 접속 MariaDB [(none)]> use mysql; Database changed MariaDB [(mysql)]> create database DB명; MariaDB [(mysql)]> create user '사용자명'@'localhost' identified by '사용자 비밀번호'; MariaDB [(mysql)]> grant all privileges on DB명.*to '사용자명'@'localhost'; //권한 부여 MariaDB [drupal]> flush privileges; // 권한 새로고침 |
9. Drupal 설치
- http://서버IP/ 로 접속해 drupal 설치 진행
- 한국어로 나오기때문에 쉽게 설치할 수 있다.