728x90
반응형
---------------------------------------------------------------------------------------------------------------------------
NGINX COFIGURATION
---------------------------------------------------------------------------------------------------------------------------
yum install gcc gcc-c++ make autoconf wget libxml2-devel perl perl-devel perl-ExtUtils-* pcre-devel openssl-devel zlib library cpan
tar xvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_perl_module \
--with-http_mp4_module
mp4 는 걍 해봄..
make && make install
install -m 700 /dev/null /etc/init.d/nginx
vi /etc/init.d/nginx
============================
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
$nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
============================
vi /usr/local/nginx/conf/nginx.conf
============================
worker_processes 8; (cpu 갯수정도가 적당)
events {
worker_connections 2048; (1024 or 2048 이 적당)
}
http {
.....
keepalive_timeout 15;
client_body_buffer_size 8K;
client_header_buffer_size 1k;
client_max_body_size 20m;
large_client_header_buffers 2 1k;
client_body_timeout 10;
client_header_timeout 10;
send_timeout 10;
......
}
location / {
root html;
index /;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://tomcat server IP:8080;
}
============================
/etc/init.d/nginx start
---------------------------------------------------------------------------------------------------------------------------
TOMCAT CONFIGURATION
---------------------------------------------------------------------------------------------------------------------------
가서 JDK 8 다운
rpm -Uvh jdk-8u101-linux-x64.rpm
vi /etc/profile
============================
#JAVA JDK8
export JAVA_HOME=/usr/java/jdk1.8.0_101
export PATH=$PATH:$JAVA_HOME/bin
#TOMCAT
export CATALINA_HOME=/usr/local/tomcat
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar
============================
source /etc/profile
java -version
wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz
tar xvf apache-tomcat-8.0.36.tar.gz
mv apache-tomcat-8.0.36 /usr/local/tomcat
cd /usr/local/tomcat
vi /etc/init.d/tomcat
=======================================
#don't reomve chkconfig
#chkconfig: 2345 95 20
CATALINA_HOME=/usr/local/tomcat; export CATALINA_HOME
JAVA_HOME=/usr/java/jdk1.8.0_101; export JAVA_HOME
start() {
echo -n "starting Tomcat: "
$CATALINA_HOME/bin/startup.sh
}
stop() {
echo -n "stopping Tomcat: "
$CATALINA_HOME/bin/shutdown.sh
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo $"Usage: tomcat {start|stop}"
exit
esac
======================================
vi /usr/local/tomcat/bin/catalina.sh
======================================
......
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
darwin=false
os400=false
hpux=false
case "`uname`" in
CYGWIN*) cygwin=true;;
Darwin*) darwin=true;;
OS400*) os400=true;;
HP-UX*) hpux=true;;
esac
JAVA_OPTS="-Djava.awt.headless=true -server -Xms5120m -Xmx10240m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+DisableExplicitGC -Dsun.zip.disableMemoryMapping=true"
JAVA_OPTS="-Djava.awt.headless=true -server -Xms5120m -Xmx10240m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:+DisableExplicitGC -Dsun.zip.disableMemoryMapping=true -javaagent:/pinpoint-agent-1.5.2/pinpoint-bootstrap-1.5.2.jar -Dpinpoint.agentId=was1 -Dpinpoint.applicationName=P_PLUS_WAS1"
.....
======================================
vi /usr/local/tomcat/conf/server.xml
======================================
protocol="org.apache.coyote.http11.Http11Nio2Protocol" 요즘 트랜드
<Connector port="8080" protocol="HTTP/1.1" maxThreads="250" maxHttpHeaderSize="8192"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" disableUploadTimeout="true" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" uriencoding="UTF-8"/>
======================================
chmod +x /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig --level 2345 tomcat on
service tomcat start
웹에서 관리할 수 있도록,유저를 등록해 둬야 한다.
vi /usr/local/tomcat/conf/tomcat-users.xml
1 2 3 4 5 | < tomcat-users > < role rolename = "admin-gui" /> < role rolename = "manager-gui" /> < user username = "tomcat" password = "tomcat" roles = "manager-gui, admin-gui" /> </ tomcat-users > |
반응형
'엔지니어 > Linux' 카테고리의 다른 글
backdoor 탐지 (0) | 2017.01.17 |
---|---|
nginx_stats(zabbix nginx script) (0) | 2017.01.16 |
elasticsearch 검색 엔진 만들기 (with jdbc, 은전한닢) (1) | 2017.01.16 |
ats 모듈 만들기 (0) | 2017.01.13 |
Apache traffic server-5.2.1 install (0) | 2017.01.13 |