nginx compile option

리눅스/어플리케이션 2013. 7. 27. 19:13 Posted by Relipmoc

./configure \

--prefix=/opt/nginx \

--sbin-path=/opt/nginx/sbin/nginx \

--conf-path=/opt/nginx/conf/nginx.conf \

--error-log-path=/opt/nginx/logs/error.log \

--pid-path=/var/run/nginx.pid \

--lock-path=/var/lock/subsys/nginx \

--user=nobody \

--group=nobody \

--http-log-path=/opt/nginx/logs/access.log \

--http-client-body-temp-path=/opt/nginx/client_body_temp \

--http-proxy-temp-path=/opt/nginx/proxy_temp \

--http-fastcgi-temp-path=/opt/nginx/fastcgi_temp \

--http-uwsgi-temp-path=/opt/nginx/uwsgi_temp \

--with-pcre \

--with-debug \

--with-http_ssl_module \

--with-http_realip_module \

--with-http_stub_status_module \

--with-http_flv_module \

--with-http_ssl_module \

--with-http_dav_module

댓글을 달아 주세요

  1. http://www.dort.jp/bk02.html 2013.10.17 03:52  댓글주소  수정/삭제  댓글쓰기

    마던Humans are creatures of habit. We’re predisposed to find routines, create schedules and return to behaviors over and over again. Even fashion, which encourages newness and exploration, becomes somewhat rote over time. Most fashion people find a uniform for themselves as they spend more and more time thinking about style and what makes them feel like themselves,birkenstock australia, and at least f적는

  2. YONGNAM 2015.09.17 14:12 신고  댓글주소  수정/삭제  댓글쓰기

    요새 누가 이런거 컴팔해서 쓰냐. rpm 걍 깔아서 쓰는게 백배는 편하지.

PostgreSQL chkconfig script

리눅스/어플리케이션 2013. 7. 27. 19:03 Posted by Relipmoc

댓글을 달아 주세요

  1. YONGNAM 2014.10.31 17:19 신고  댓글주소  수정/삭제  댓글쓰기

    개새끼가 내꺼 퍼갔네

  2. Relipmoc 2015.01.22 17:17 신고  댓글주소  수정/삭제  댓글쓰기

    블로그 터트렸잖아ㅡㅡ

[Apache] mod_watch backup

리눅스/어플리케이션 2011. 8. 20. 06:12 Posted by Relipmoc

Apache Mod_Watch & Munin Graphs showing vhost accesses

While this is more of an apache topic than a munin one, the main reason I wanted to compile the mod_watch module for apache is so I can graph vhost usage and access. Munin will then show graphs of how much a vhost is used. Also, while there are other how-to websites out there for this, they seem to drop off and disappear after a few years.

mod_watch itself is not supported and is actually quite difficult to get a hold of. I was using this on Debian Etch and Lenny on a x32 system. Copying the mod_watch.so and running on x64 failed so I needed to recomiple on a x64 debian squeeze.

The main reference I used was: http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ This worked perfectly. There was an issue with debian squeeze which will be sorted below.

Compile

apt-get install apache2-dev libcrypt-ssleay-perl libwww-perl make
wget http://wiki.kartbuilding.net/mod_watch-4.3_apache22_mod.tar.gz
#gunzip and tar -xvf
nano Makefile.dso
//change APXS location to:
APXS=/usr/bin/apxs2

make -f Makefile.dso build
make -f Makefile.dso install 

Add and config mod_watch apache module

vi /etc/apache2/mods-available/watch.load
//add in
LoadModule watch_module /usr/lib/apache2/modules/mod_watch.so

a2enmod watch
vi /etc/apache2/sites-enabled/01-default  (or whatever vhost you want)
       <Location /watch-info>
         SetHandler watch-info
           Order deny,allow
           Deny from all
           Allow from 127.0.0.1 ::1
       </Location>
       <Location /watch-list>
        SetHandler watch-list
           Order deny,allow
           Deny from all
           Allow from 127.0.0.1 ::1
       </Location>

/etc/init.d/apache2 restart

Checking mod_watch for errors

elinks http://localhost/watch-list
#check for output

mod_watch Errors received

in error.log with Debian Squeeze running 2.6.32-5-amd64

tail -f /var/log/apache2/error.log
//I noticed the following warns when I accessed any vhosts with mod_watch enabled
[Fri Mar 18 22:35:36 2011] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchPostReadRequestHash()
[Fri Mar 18 22:35:36 2011] [error] shVerifyString(7fca84e5aae8, 7fca83c946f8) failed!
[Fri Mar 18 22:35:36 2011] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "monitor2.burkesys.com") failed in watchLogHash()
[Fri Mar 18 22:35:36 2011] [error] shVerifyString(7fca84e5aae8, 7fca83c94718) failed!
[Fri Mar 18 22:35:36 2011] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchLogHash()

resolve mod_watch errors

Googling led me to http://forums.cacti.net/viewtopic.php?p=186639#p186639

cd /root/mod_watch-4.3_apache22_mod/
vi SharedHash.c
//on line 102 change to look like:
shVerifyString(struct shTable *tp, char *str)
{
   /* if ((char *) tp->shared <= str && str < (char *) tp->eshared) { */
   if ((char *) apr_shm_baseaddr_get(tp->shared) <= str && str < (char *) tp->eshared) {
       if (str + strlen(str) < (char *) tp->eshared)
           return str;
   }

So now browing various vhosts on the server showed no errors in error.log. Using elinks (apt-get install elinks) going to http://localhost/watch-list showed results.

Munin Plugin for Mod_Watch

cd /usr/share/munin/plugins
wget http://wiki.kartbuilding.net/apache_watch
chmod 755 apache_watch
vi apache_watch
//change my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://monitor2.burkesys.com:%d/watch-list"; to:
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://server.com:%d/watch-list";

ln -s /usr/share/munin/plugins/apache_watch /etc/munin/plugins/apache_watch_requests

That should do it. Once mod_watch is working and accessible munin should pick it up ok. References: http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ 
http://exchange.munin-monitoring.org/plugins/apache_watch_/version/1 
http://forums.cacti.net/about15475.html

This is a nice apache module. I'm surprised that there is no maintained similar apache module. I've seen another similar munin plugin that parses /var/log/apache2/vhost%_access.log to generate these graphs, however it requires separate log files for each vhost and parses the logs every so often. Any more info /queries / suggestions drop us a mail sburke[at]burkesys.com

댓글을 달아 주세요

[MRTG] 자동 설치 스크립트

리눅스/어플리케이션 2011. 8. 16. 19:48 Posted by Relipmoc
CentOS 5 기준이며, 다른 배포판일 경우 패키지 설치 명령어만 다르고 나머지는 같으.. ㄹ 겁니다
실사용 하실 때 설치 스크립트에서 주석은 달아 놨으니 변수부분만 바꿔주시면 되며, 이 스크립트는 MRTG 설치&설정 스크립트지 SNMP 설정은 하지 않습니다.

#!/bin/sh
# Author: Larry Kim <admin@relip.org>

# ============= 변수 선언 =============

MRTG_CFG_PATH="/etc/mrtg/local.cfg" # MRTG 설정파일 경로. 꼭 obsolute path 여야함!
MRTG_WORK_DIR="/data/www/www.relip.org/mrtg/" # 데이터, 그래프들을 저장할 경로
SNMP_VERSION="2" # SNMP 버전 
SNMP_HOST="localhost" # SNMP 데이터를 가져올 서버의 아이피 또는 도메인
SNMP_COMMUNITY="public" # SNMP 커뮤니티 이름

# ============= 변수 선언 끝 ==========

yum -y install mrtg
cfgmaker --snmp-options=:::::${MRTG_SNMP_VERSION} --global "WorkDir: ${MRTG_WORK_DIR}" --global 'Language: korean' --global 'Options[_]: bits,growright' --global 'Refresh: 300' --global 'WriteExpires: Yes' --output ${MRTG_CFG_PATH} ${SNMP_COMMUNITY}@${SNMP_HOST}
indexmaker ${MRTG_CFG_PATH} --output=${MRTG_WORK_DIR}/index.html
echo "*/5 * * * * root env LANG=C /usr/bin/mrtg ${MRTG_CFG_PATH}  > /dev/null 2>&1" >>  /etc/crontab 

참 쉽ㅈ.. 
TAG MRTG

댓글을 달아 주세요

그냥 복붙할 수 있도록 스크립트 형식으로 작성.


#기본적인 라이브러리/툴 설치:
yum groupinstall "Development Tools"
yum groupinstall "Development Libraries"

#mysql: Version: 5.5.15
# groupadd 가 안될 경우 밑의 주석을 풀어준다.
# export PATH=$PATH:/usr/sbin:/sbin
groupadd mysql
useradd mysql
wget http://mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mirror.khlug.org/mysql/
tar zxvf mysql-5.5.15.tar.gz
cd mysql-5.5.15
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum -y install cmake

cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DMYSQL_DATADIR=/opt/mysql/data \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFIGDIR=/etc \
-DWITH_EXTRA_CHARSETS=all \

-DWITH_DEBUG=0  
make
make install

cd ../

#apache: Version: 2.2.19
wget http://mirror.khlug.org/apache//httpd/httpd-2.2.19.tar.gz
tar zxvf httpd-2.2.19.tar.gz 
cd httpd-2.2.19
 ./configure --prefix=/opt/httpd --enable-modules=so --enable-module=shared --enable-mods-shared=all --enable-so --enable-ssl --enable-rewrite --enable-rule=SHARED_CORE --enable-mods-shared=ssl --with-ssl --with-mpm=prefork --enable-modules=unique_id
make
make install

cd ../

#php: Version: 5.3.6
wget http://www.php.net/get/php-5.3.6.tar.gz/from/kr.php.net/mirror 
tar zxvf php-5.3.6.tar.gz
cd php-5.3.6
yum install -y libjpeg-devel libpng-devel net-snmp-devel libmcrypt-devel libc-client-devel pcre pcre-devel openssl openssl-devel libxml2 libxml2-devel bzip2-devel gdbm gdbm-devel libcurl-devel reestype freetype-devel cyrus-sasl-ldap cyrus-sasl-ldap-devel openldap-devel libmcrypt-devel expat-devel
./configure  --prefix=/opt/php --with-apxs2=/opt/httpd/bin/apxs --with-config-file-path=/opt/httpd/conf --disable-debug --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-sigchild --enable-soap --enable-sockets --enable-wddx --enable-zip --with-bz2 --with-curl=/usr --with-freetype-dir=/usr --with-gd --with-gdbm=/usr --with-gettext --with-iconv --with-imap --with-imap-ssl --with-jpeg-dir=/usr --with-kerberos --with-ldap --with-libexpat-dir --with-libxml-dir --with-mcrypt --with-openssl --without-sqlite --with-png-dir=/usr --with-snmp --with-xmlrpc --with-zlib --with-mcrypt --with-mysql=/opt/mysql --with-pdo-mysql=/opt/mysql
make
make install

cd ../ 


댓글을 달아 주세요

PHP Version: 5.2.13

이 오류가 나는 이유는, FreeTDS 를 패키지로 설치할 때, 라이브러리가 lib64에 복사되기 때문이다. 하지만 PHP 는 --with-mssql 옵션을 주면 /usr/lib 에서 라이브러리를 찾는다.


ln -s /usr/lib64/libsybdb.so /usr/lib/
./configure [중간 옵션] --with-mssql
make
make install


댓글을 달아 주세요

  1. ugg 2013.07.28 17:49  댓글주소  수정/삭제  댓글쓰기

    지금은 반짝반짝 빛이 나겠지,, 하지만 시간이 흐르면 그빛은 사라저버릴거야,지금 우리처럼


우분투, 센토스 등 패키지로 제공되는 아파치는 잘 모르겠으나, 컴파일한 아파치의 경우에는 apachectl 이 chkconfig 로 등록이 안된다. 왜냐하면, chkconfig 는 쉘스크립트 내용안에 

# chkconfig: - 85 15
# description: Apache is a World Wide Web server. \
# It is used to serve HTML files and CGI.
같은 내용을 포함하고 있어야 하는데, 기본으로 제공되는 스크립트에는 포함이 안돼있기 때문이다. 
여기까지 설명하면 다들 알아차리겠지만,

엄청쉽다. 
그냥 위에 쓴 저 내용을 apachectl 파일의 #!/bin/sh 다음줄에 추가만 하면 끝이다. 

즉,

Before 
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0

After 
#!/bin/sh
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  \
#              It is used to serve HTML files and CGI.

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0

그리고 chkconfig 에 등록

[root@test ~]# /sbin/chkconfig --add httpd
[root@test ~]# /sbin/chkconfig --level 2345 httpd on

결과:

[root@rb1 ~]# chkconfig --list | grep httpd
httpd           0:해제 1:해제 2:활성 3:활성 4:활성 5:활성 6:해제

댓글을 달아 주세요

  1. 확분 2011.01.03 03:40  댓글주소  수정/삭제  댓글쓰기

    새해인데 이런 전문지식을..

  2. http://www.moncleroutletespain.com/ 2013.01.05 22:27  댓글주소  수정/삭제  댓글쓰기

    Un des trois cadres dirigeants mis à pied par Renault dans l'affaire d'espionnage industriel qui ébranle le constructeur automobile fran, http://www.moncleroutletespain.com/ moncler outlet?ais est convoqué mardi pour un entretien préalable à un éventuel licenciement, http://www.moncleroutletespain.com/ moncler online, a appris l'AFP samedi soir de sources concordantes, http://www.moncleroutletespain.com/ moncler. Economie Activité perturbée par une grève dans les ports fran, http://www.moncleroutletespain.com/ moncler españa?ais Economie Dioxine: Berlin veut des sanctionsRelated articles:


    http://golf360.tistory.com/68 http://golf360.tistory.com/68

    http://dummy.pe.kr/1656 http://dummy.pe.kr/1656

[작성중] 

CentOS 5.5 기준 

# yum install -y libjpeg-devel libpng-devel net-snmp-devel libmcrypt-devel libc-client-devel 
#  ./configure  --prefix=/opt/php --with-apxs2=/opt/httpd/bin/apxs --with-config-file-path=/opt/httpd/conf --disable-debug --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-magic-quotes --enable-mbregex --enable-mbstring --enable-mod-charset --enable-sigchild --enable-soap --enable-sockets --enable-wddx --enable-zip --with-bz2 --with-curl=/usr --with-freetype-dir=/usr --with-gd --with-gdbm=/usr --with-gettext --with-iconv --with-imap --with-imap-ssl --with-jpeg-dir=/usr --with-kerberos --with-ldap --with-libexpat-dir --with-libxml-dir --with-mcrypt --with-openssl --without-sqlite --with-png-dir=/usr --with-snmp --with-xmlrpc --with-zlib --with-mcrypt --with-mysql=/opt/mysql --with-pdo-mysql=/opt/mysql
# make
# make install

댓글을 달아 주세요

  1. YONGNAM 2011.02.10 22:37 신고  댓글주소  수정/삭제  댓글쓰기

    두달 넘도록 작성 중이어버렷
    영원히 작성중 이어버렷

  2. YONGNAM 2011.05.27 18:07 신고  댓글주소  수정/삭제  댓글쓰기

    6개월째 작성중 이어버렷