본문 바로가기

IT/centos

리눅스 아파치 설치

1. 개발툴 설치

[ec2-user@ip-172-31-16-251 ~]$ sudo yum install gcc gcc-c++
[ec2-user@ip-172-31-16-251 ~]$ sudo yum groupinstall Development Tools Development Libraries

2. 다운로드 및 압축해제(pcre, apr, apr-util, apache)

[ec2-user@ip-172-31-16-251 ~]$ cd /tmp/
[ec2-user@ip-172-31-16-251 tmp]$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
[ec2-user@ip-172-31-16-251 tmp]$ wget http://apache.tt.co.kr/apr/apr-1.6.2.tar.gz
[ec2-user@ip-172-31-16-251 tmp]$ wget http://apache.tt.co.kr/apr/apr-util-1.6.0.tar.gz
[ec2-user@ip-172-31-16-251 tmp]$ wget http://apache.tt.co.kr/httpd/httpd-2.4.27.tar.gz

[ec2-user@ip-172-31-16-251 tmp]$ tar xvf pcre-8.41.tar.gz
[ec2-user@ip-172-31-16-251 tmp]$ tar xvf apr-1.6.2.tar.gz
[ec2-user@ip-172-31-16-251 tmp]$ tar xvf apr-util-1.6.0.tar.gz
[ec2-user@ip-172-31-16-251 tmp]$ tar xvf httpd-2.4.27.tar.gz

[ec2-user@ip-172-31-16-251 tmp]$ mv apr-1.6.2 ./httpd-2.4.27/srclib/apr
[ec2-user@ip-172-31-16-251 tmp]$ mv apr-util-1.6.0 ./httpd-2.4.27/srclib/apr-util

3. pcre 설치

[ec2-user@ip-172-31-16-251 tmp]$ cd pcre-8.41
[ec2-user@ip-172-31-16-251 pcre-8.4]$ ./configure  --prefix=/usr/local/pcre
[ec2-user@ip-172-31-16-251 pcre-8.4]$ sudo make
[ec2-user@ip-172-31-16-251 pcre-8.4]$ sudo make install

4. apache 설치

[ec2-user@ip-172-31-16-251 tmp]$ cd httpd-2.4.27
[ec2-user@ip-172-31-16-251 httpd-2.4.27]$ ./configure --prefix=/usr/local/apache2 --enable-mods-shared=most --enable-module=so --enable-rewrite --with-mpm=worker  --enable-ssl --enable-so
[ec2-user@ip-172-31-16-251 httpd-2.4.27]$ sudo make
[ec2-user@ip-172-31-16-251 httpd-2.4.27]$ sudo make install

5. apache 환경설정

[ec2-user@ip-172-31-16-251 httpd-2.4.27]$ sudo vim /usr/local/apache2/conf/httpd.conf

Listen 172.31.16.251:80

User nobody
Group nobody

ServerName localhost

6. apache 실행

[ec2-user@ip-172-31-16-251 httpd-2.4.27]$ sudo /usr/local/apache2/bin/httpd -k stop 
[ec2-user@ip-172-31-16-251 httpd-2.4.27]$ sudo /usr/local/apache2/bin/httpd -k start

7. 서비스 폴더 권한설정

[ec2-user@ip-172-31-16-251 ~]$ sudo groupadd www
[ec2-user@ip-172-31-16-251 ~]$ sudo usermod -a -G www ec2-user
[ec2-user@ip-172-31-16-251 ~]$ groups
ec2-user wheel www
[ec2-user@ip-172-31-16-251 ~]$ sudo chown -R root:www /usr/local/apache2/htdocs/
[ec2-user@ip-172-31-16-251 ~]$ sudo chmod 2775 /usr/local/apache2/htdocs/

'IT > centos' 카테고리의 다른 글

Centos7 & APM 구버전 설치  (0) 2018.04.14
apache ssl 인증서 설치  (0) 2017.10.03
apache - tomcat 연동 mod_jk  (0) 2017.10.03