* Apache Version 확인
$ apachectl -v
Server version: Apache/2.4.16 (Unix)


* PHP Version 확인
$ php -v
PHP 5.5.29 (cli) (built: Sep  6 2015 20:20:34) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies


* apache 설정
$ sudo vi /private/etc/apache2/httpd.conf 파일. 다음 내용들에서 주석 제거
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
// ssl 을 사용하려면 아래의 내용도 주석제거해야 함
LoadModule ssl_module libexec/apache2/mod_ssl.so
Include /private/etc/apache2/extra/httpd-ssl.conf


* sudo vi /private/etc/apache2/extra/httpd-vhosts.conf 파일에 아래 내용 추가
<VirtualHost *:80>
    ServerAdmin 어드민메일주소
    DocumentRoot "/Users/xxx/도큐먼트루트dir"
    ServerName 사이트url
    ErrorLog "/private/var/log/apache2/사이트url.local-error_log"
    CustomLog "/private/var/log/apache2/사이트url.local-access_log" common
    <Directory "/Users/xxx/도큐먼트루트dir">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

* ssl 사용하려면
  sudo vi /private/etc/apache2/extra/httpd-ssl.conf 파일에 아래 내용 추가
<VirtualHost _default_:443>
DocumentRoot "/Users/xxx/도큐먼트루트dir"
ServerName device.storyand.com:443
ServerAdmin leesw@storyand.com
ErrorLog "/private/var/log/apache2/사이트url.error_ssl_log"
TransferLog "/private/var/log/apache2/사이트url.access_ssl_log"
SSLEngine on
SSLCertificateFile "/Users/xxx/인증서.crt파일경로"
SSLCertificateKeyFile "/Users/xxx/인증서.key파일경로"
SSLCACertificateFile "/Users/xxx/인증서.cer파일경로"
SSLVerifyClient require // 클라이언트 ssl 인증서 강제할때
SSLVerifyDepth  10
       <Directory "/Users/xxx/도큐먼트루트dir">
           Options Indexes FollowSymLinks
           AllowOverride All
           Order allow,deny
           Allow from all
       </Directory>
</VirtualHost>


* sudo vi /private/etc/apache2/httpd.conf 파일에서 아래 내용 수정
DocumentRoot "/Users/xxx/도큐먼트루트dir"
<Directory "/Users/xxx/도큐먼트루트dir">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride None
    Require all granted
</Directory>


* 설정파일 검사
$ sudo apachectl configtest


* apache 재시작
$ sudo apachectl stop
$ sudo apachectl start
$ sudo apachectl restart


* php 실행시 timezone 설정하라는 경고가 나오면
(Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier...)
/private/etc/php.ini.default 파일을 php.ini 로 복사한후
php.ini 파일에서 아래의 내용 수정한다.
date.timezone = Asia/Seoul



반응형
Posted by 돌비
,