티스토리 뷰

반응형

우분투의 평이 너무 좋아서 여지껏 사용해오던 centos 를 버리고 서버를 갈아타게 되었다.


갈아타자마자 APM을 설치해본다.


1. 제일 먼저 서버 업그레이드부터 시행한다.

# sudo apt-get update

# sudo apt-get upgrade

2. apache2 설치하기

# sudo apt-get install apache2

# sudo apt-get upgrade

2-1. apache configtest

# sudo apache2ctl configtest

위의 명령어를 입력시 다음과 같은 에러가 나온다.

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message

Syntax OK


2-2. apache config 변경

# sudo nano /etc/apache2/apache2.conf

설정파일 제일 하단에 다음과같이 자신의 도메인 주소 또는 IP를 입력한다.

ServerName lbr.kr

그리고 다시 config test를 진행하면 Syntax OK 만 나오게 된다.

변경사항 저장을 위해 아파치를 재시작한다.

# sudo systemctl restart apache2

여기까지 잘 설치가 되었다면, 자신의 도메인으로 접속시 다음 화면을 볼수 있다.


3. mysql 설치하기

# sudo apt-get install mysql-server

패스워드 입력 프롬프트 창이 나오면, 사용할 root 패스워드를 입력한다.


# sudo mysql_secure_installation

root 패스워드를 입력하고 나면 다음과같이 VALIDATE PASSWORD plugin 을 사용하겠냐고 묻는다. 


VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin? 


강력한 보안을 위한다면 사용하지만 그렇지 않으면 사용하지 않는게 좋겠다. 

그러므로 패스. 

다음은 나머지 과정들에 대한 선택이다.

Remove anonymous users? (Press y|Y for Yes, any other key for No) :No

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : No

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y


4. php 주요 모듈과 함께 설치하기

# sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cli php-common php-mysql

설치가 끝났으면 다음 파일을 생성한다.

vi /var/www/html/index.php

 다음 코드를 넣은 후

<?php echo phpinfo()?>


브라우저에서 http://[도메인]/index.php 를 실행해본다. 

이렇게 나오면 성공!

php 버전이 7.0이다!! 

우분투에서는 기본설치가 무려 7.0이라니 놀랍다...


다음.. 유용할 설정들을 살펴보자


5. 디렉토리 인덱스 파일 우선순위 설정하기

기본적으로 디렉토리안에 index.html 파일과 index.php 파일이 있다면 index.html 파일을 참고하게 된다.

다음파일을 편집한다.

# sudo nano /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>

         변경전 :: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

         변경후 :: DirectoryIndex index.php index.cgi index.pl index.html index.xhtml index.htm

</IfModule>


변경사항 저장을 위해 재시작 한다.

# sudo systemctl restart apache2


6. php 모듈 살펴보기 

추가로 모듈을 설치하고싶은 경우 다음 명령어로 사용가능한 모듈을 살펴본다.

# apt-cache search php- | less

추가로 설치를 원하는 경우 다음과같이 설치하면 된다.


# sudo apt-get install php-cli php-common php-gd php-curl


끝.


반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함