Amazon Linux 2에서 Apache와 Tomcat 구성(Web, WAS 서버 구축)

2020. 6. 3. 12:50IT/AWS

728x90

1. Web 서버 구축

# yum groupinstall "Development Tools"
# yum install pcre*
# yum install apr*

 

# wget http://apache.tt.co.kr//httpd/httpd-2.4.43.tar.gz 
# tar xvzf httpd-2.4.43.tar.gz 
# cd /apps/httpd-2.4.41
# ./configure --prefix=/apps/apache
# make && make install
# cd /apps/apache/conf/httpd.conf

 

아래 코드 주석을 해제한다.

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

 

아래 내용을 추가한다.

<VirtualHost *:80>
 ServerName localhost
 ProxyRequests Off
 ProxyPreserveHost On
 ProxyPass / http://localhost:8080/
 ProxyPassReverse / http://localhost:8080/
</VirtualHost>
 
<VirtualHost *:80>
 
DocumentRoot "/webdocs/www"
DirectoryIndex index.html
 
 ProxyRequests Off
 ProxyPreserveHost On
 
 <Proxy *>
  Order deny,allow
  Allow from all
 </Proxy>
 
 ProxyPass              /index.html !
 ProxyPassReverse       /index.html !
 
## for static contents
 <Location /static/>
  ProxyPass !
 </Location>
 
 ProxyPass / http://localhost:8080/
 ProxyPassReverse / http://localhost:8080/
 <Location />
  Order allow,deny
  Allow from all
  Require all granted
 </Location>
</VirtualHost>

 

서비스 시작 및 포트 열림을 확인한다.

# ./apachectl start
 # netstat -natup | grep 80
300x250