본문 바로가기

UNIX/Linux/OSX

[AWS] 아파치 톰캣 연동

yum으로 설치

sudo yum install gcc

sudo yum install make

sudo yum install gcc-c++


sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd

sudo yum install mysql-server

sudo yum install httpd-devel.x86_64 httpd-tools.x86_64


볼륨마운트

sudo mkdir data1

sudo mount /dev/sdf /data1


sudo vi /etc/fstab

추가 : data1        /dev/sdf       data1    defaults        0   0


MySQL 컨피그 수정

sudo vi /etc/my.cnf

datadir 수정


캐릭터셋 변경

init_connect='SET collation_connection = utf8_unicode_ci'

init_connect='SET NAMES utf8'

character-set-server=utf8

collation-server=utf8_unicode_ci

skip-character-set-client-handshake


sudo /etc/init.d/mysqld start

mysqladmin -u root password '비밀번호'


아파치 설정

sudo vi /etc/httpd/conf/httpd.conf

수정 : DocumentRoot "/data1/www/html"

수정 : <Directory "/data1/www/html">

수정

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /data1/www/html

    ServerName ec2.php.com

    DirectoryIndex index.html index.php

</VirtualHost>


아파치 기동

sudo /etc/init.d/httpd start


권한설정 (시스템 구동시 자동 시작)

sudo chkconfig --levels 235 mysqld on

sudo chkconfig --levels 235 httpd on


php등을 위한 hosts설정

hosts

54.248.115.161 ec2.php.com

54.248.115.161 ec2.phpmyadmin.com


--tomcat connector

sudo yum install autoconf.noarch

sudo yum install libtool.x86_64


cd /data1/install_files/tomcat-connectors-1.2.32-src/native

./buildconf.sh

sudo ./configure --with-apxs=/usr/sbin/apxs

sudo make

sudo make install


-- tomcat 연동

cd /etc/httpd/conf


sudo vi workers.properties

workers.tomcat_home=/data1/apache-tomcat-6.0.35

workers.java_home=/usr/bin/java

ps=/

worker.list=default

worker.default.port=8009

worker.default.host=localhost

worker.default.type=ajp13

worker.default.lbfactor=1


sudo vi uriworkermap.properties

/*.do = default

/*.jsp = default


sudo vi /etc/httpd/conf/httpd.conf

주석해제 : NameVirtualHost *:80

추가 : LoadModule jk_module modules/mod_jk.so

추가 : 

<IfModule jk_module>

    JkWorkersFile conf/workers.properties

    JkLogFile logs/mod_jk.log

    JkLogLevel error

</IfModule>



<VirtualHost *:80>

    JkMountFile conf/uriworkermap.properties

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /data1/apache-tomcat/webapps/riderhub

    ServerName ec2-54-248-115-161.ap-northeast-1.compute.amazonaws.com

    DirectoryIndex index.jsp

</VirtualHost>


phpmyadmin
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo yum install phpmyadmin
sudo vi /etc/httpd/conf.d/phpmyadmin.conf

주석처리
#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from 127.0.0.1
#</Directory>

cd /usr/share/phpmyadmin/
sudo cp config.sample.inc.php config.inc.php
sudo vi config.inc.php
수정
$cfg[Servers'][$i]['auth_type'] = 'http';
sudo vi /etc/httpd/conf/httpd.conf
추가
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /usr/share/phpmyadmin
    ServerName ec2.phpmyadmin.com
    DirectoryIndex index.php
</VirtualHost>