서버관리/Linux / / 2019. 8. 3. 22:39

YII2 Framework 으로 개발된 사이트를 서버이전하는 방법

반응형

새로 이전 될 서버를 아래 환경으로 세팅한다.

 

1, PHP를 최소 7.2 버전 이상으로 설치한다.

(PHP7.2 로 업그레이드 하는 방법은 https://koreaidc.tistory.com/49 를 참고하시면 됩니다.)

 

 

2, php.ini 파일에서 아래 옵션을 수정하거나 추가한다.

 

expose_php = Off

log_errors = On
error_log = "/usr/local/lnmp/php/var/log/error_log"
error_reporting=E_ALL&~E_NOTICE

(혹은 index.php 상단에 error_reporting(E_ALL ^ E_NOTICE); 추가)

(이 설정대로 하지 않으면 웹페이지는 undefined offset 혹은 undefined index 에러가 나타날 수 있다.)

 

 

yum -y install php-pgsql
yum -y install memcached  
yum -y install php-memcached

 

 

 

3, 웹서버 설정파일을 아래와 같이 수정한다.

 

//Apache 웹서버라면 설정파일에서 아래 사항을 수정 혹은 추가 한다.

# Set document root to be "basic/web"
DocumentRoot "path/to/basic/web"

<Directory "path/to/basic/web">
    # use mod_rewrite for pretty URL support
    RewriteEngine on
    
    # if $showScriptName is false in UrlManager, do not allow accessing URLs with script name
    RewriteRule ^index.php/ - [L,R=404]
    
    # If a directory or a file exists, use the request directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # Otherwise forward the request to index.php
    RewriteRule . index.php

    # ...other settings...

 

(참고문서: https://github.com/yiisoft/yii2/blob/master/docs%2Fguide%2Fstart-installation.md#recommended-apache-configuration-)

반응형
  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유