[Mac] 맥미니에 wordpress 설치하기(1) - Apache 설치하기

Published on: 2013. 11. 14. 16:35 by louis.dev
mac에는 기본적으로 Apache 2 버전이 기본적으로 설치되어있다. 그런데 버전이 현재 마운틴라이언 기준 2.2 버전이 설치되어있어 기존에 설치되어있는 아파치 말고 최신버전의(현재 2.4.6) 아파치를 설치해보도록 하겠다. 아파치를 설치하기 전에 먼저 설치해야 할것들이 있다. 

1) xcode 설치하기(App store에서 xcode 검색하여 설치) 

2) make 설치하기 

3) wget 설치하기 위의 3가지를 모두 설치하였다면 아파치 설치를 아래와 같이 진행한다.

$ sudo mkdir /program/apache2                  //아파치 설치 디렉토리 생성
$ sudo chown -R krespo:staff /program/apache2 //디렉토리 소유자를 유저:그룹 으로 변경합니다.
$ cd ~/Downloads
$ wget http://mirror.apache-kr.org//httpd/httpd-2.4.6.tar.gz
$ tar zvxf httpd-2.4.6.tar.gz
$ cd httpd-2.4.6
$ ./configure --prefix=/program/apache2
$ make
$ sudo make install
$ sudo chown -R krespo:staff /program/apache2

// configure: error: C compiler cannot create executables 라는 에러 발생시 아래 명령어 실행
$  cd /Applications/Xcode.app/Contents/Developer/Toolchains/
$  sudo ln -s XcodeDefault.xctoolchain OSX10.8.xctoolchain

//configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ 라는 에러 발생시
아래 명령어 실행
$ wget http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.33%2F&ts=1377965571&use_mirror=jaist
$ tar zvxf pcre-8.33
$ cd pcre-8.33
$ ./configure
$ make
$ sudo make install
다음으로 ${apache설치경로}/conf/httpd.conf 파일안의 내용중 다음을 수정한다. User krespo #설치시에 디렉토리 소유자와 동일하게 맞춰준다. Group staff #설치시에 디렉토리 소유그룹과 동일하게 맞춘다. DocumentRoot "/webroot" #웹서비스를 할 Root디렉토리를 지정한다. 로 설정되어 있는 부분을 위에 DocumentRoot로 지정한 경로로 변경한다. 이후 서버가 제대로 실행이 되는지 테스트 해보기 위해 DocumentRoot로 지정된 디렉토리 하위에 test.html이라는 이름으로 파일을 생성한다. 이제 설정은 모두 끝났다. apache를 실행시켜보자.
$ sudo /program/apache2/bin/apachectl start
서버 시작시 다음과 같은 warning이 발생하게 된다.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using server.local. Set the 'ServerName' directive globally to suppress this message
이건 httpd.conf파일에 ServerName을 지정하지 않아서 Warning이 발생하는 것이다. 딱히 서버올릴때 문제가 되지 않으니 신경쓰지 않아도 된다. 이제 브라우저에 http://localhost/test.html을 쳐보면 브라우저 화면에 테스트 파일을 확인할 수 있다~