1. 개요
가. 리눅스 서버 부팅시 자동으로 시작해야하는 스크립트(또는 프로그램)가 있다면
다음과 같이 파일에 등록하면 됩니다.
나. 테스트환경 : CentOS 5.1
2. 리눅스 부팅시 스크립트 자동시작 등록
/etc/rc.d/rc.local 파일에 스크립트(예 /etc/script/report.sh) 등록
[root@ruo91 ~]# fdisk -l/dev/sdb 가 새로 추가한 하드디스크로 인식이 되었으므로 새로운 파티션을 추가 해줍니다.
Disk /dev/sda: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65140 523237018+ 83 Linux
/dev/sda2 65141 65270 1044225 82 Linux swap / Solaris
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
[root@ruo91 ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 65270.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-65270, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270): 65270
Command (m for help): p
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
a - 부트 가능한 플래그로 변경
b - bsd 디스크 레이블을 편집
c - 도스 호환 플래그로 변경
d - 파티션 삭제
l - 리눅스에서 지원하는 파티션 목록보기
m - 메뉴보기
n - 새로운 파티션 생성
o - 새로운 도스 파티션 테이블 생성
p - 현재 파티션 설정 상태 확인
q - 설정한 파티션 저장하지 않고 종료
s - 새로운 Sun 디스크 레이블 생성
t - 파티션 시스템 유형 변경
u - 표시/항목 단위를 변경
v - 파티션 레이블 점검
w - 설정한 파티션을 저장하고 종료
x - 고급 사용자를 위한 명령어
[root@ruo91 ~]# fdisk -l
Disk /dev/sda: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65140 523237018+ 83 Linux
/dev/sda2 65141 65270 1044225 82 Linux swap / Solaris
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux
[root@ruo91 ~]# mkfs -t ext3 /dev/sdb
mke2fs 1.39 (29-May-2006)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
4000 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@ruo91 ~]# mkdir /home2
[root@ruo91 ~]# mount /dev/sdb /home2
[root@ruo91 ~]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdb on /home2 type ext3 (rw)
[root@ruo91 ~]# cat > /home2/hello.cpp
#include <iostream>
int main()
{
std::cout<< "Hello World!!" <<std::endl;
return 0;
}
[root@ruo91 ~]# g++ -o /home2/hello /home2/hello.cpp
[root@ruo91 ~]# /home2/hello
Hello World!!
[root@ruo91 ~]# vim /etc/fstab
/dev/sdb /home2 ext3 defaults 0 0
[root@ruo91 ~]# reboot
[root@ruo91 ~]# mount자료출처 : http://www.cyworld.com/ruo91/3368109
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sdb on /home2 type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
아래는 어디에 쓰는 경우인지 모르겠음...
~/.profile에
export TERMINFO=/usr/lib/terminfo
export TERM=xterm
<a href="/down.php?>">[리스트 다운로드]</a>
===============down.php========================
<?
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Excel.xls");
header("Content-Description: PHP4 Generated Data");
$sql = "쿼리문입력'";
$stmt = mysql_query($sql, $connect);
$num = mysql_num_rows($stmt);
?>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<table border="1" cellpadding="1" cellspacing="0">
<tr>
<td><b>NO</b></td>
<td><b>제목</b></td>
<td><b>작성자</b></td>
<td><b>날짜</b></td>
<td><b>조회수</b></td>
</tr>
<?
for($i = 0; $i < $num; $i++)
{
$res = mysql_fetch_array($stmt);
$j++;
echo "<tr><td>$j</td><td>$res[subject]</td><td>$res[name]</td><td>$res[date]</td><td>$res[hit]</td></tr>";
}
flush();
usleep(1);
?>
</table>
제목 : 64bit APM설치 DSO방식 linux APM install 기술문서
주식회사웹호스트 http://www.webhost.co.kr
본 문서는 Linux CentOS 5.2 Final 에 최적화되었습니다.
본 문서는 여러번의 테스트를 거쳐서 완성한 웹호스트에서 제공하는 문서입니다.
1. 리눅스 패키지 필수설치문서
- 리눅스시스템이 64bit 인지 먼저확인방법
uname -a
이 명령에서
Linux localhost.localdomain 2.6.18-92.1.22.el5 #1 SMP Tue Dec 16 11:57:43 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
이런형식으로 x86_64 가 나오면 시스템은 64bit 환경이다.
- 필수 rpm설치 (for 64bit 를 위하여)
yum -y install freetype freetype-devel freetype-utils gd gd-devel libjpeg libjpeg-devel libpng libpng-devel curl curl-devel openssl flex gcc gcc-c++
위 명령은 root에서 수행할것. 기존에 있다면 알아서 걸러줌
- yum install 이 안됩니다. 왜그런가요?
vi /etc/resolv.conf 확인할 것
nameserver 168.126.63.1
로 수정하거나, 입력해서 네임서버질의가 정상적으로 되는지 확인할것
2. mysql 설치하기
우선 APM관련 rpm은 모두 삭제하라
rpm -e dovecot
rpm -e mysql
rpm -e php-common
rpm -e php-ldap
rpm -e php-cli
rpm -e php
rpm -e php-cli
rpm -e php-common
rpm -e httpd-manual
rpm -e system-config-httpd
rpm -e httpd
rpm -e mod_ssl
rpm -e mod_python
rpm -e webalizer
rpm -e mod_ssl
rpm -e httpd
rpm -e mod_perl
rpm -e httpd
vi install.sh <--아래내용입력
중요사항) 줄의 끝에 일일이 역슬래시문자를 반드시 붙이셔야 합니다.
제로보드게시물에 역슬래시를 표기하지 못하므로 보이지 않습니다.
./configure --prefix=/usr/local/mysql \
--localstatedir=/home/MySQL/DATA \
--sysconfdir=/etc --disable-shared \
--with-mysqld-user=mysql \
--with-charset=euckr \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--without-docs --without-bench \
--without-isam \
--with-extra-charsets=all \
--with-innodb \
--without-debug
[참고사항] utf8 경우, --with-charset=utf8 \
mysql 4.1.x 대 설치시는 --with-charset=euckr \
저장하고 빠진후
chmod 700 install.sh
./install.sh
make && make install
========================================
참고) 에러유형 libmysqlclient.so.15 생성안될때 (에러날때만 참고할것)
- ls libmysql/.libs 해서 libmysqlclient.so.15 있는지 확인 (make까지만 해본후 리스트확인)
- 설치후 mysql 입력시 위 so.15 에러날때 어떻게 해야하나?
* 아래와 같이 --disable-shared옵션을 제거한 후에 설치한다.
./configure --prefix=/usr/local/mysql \
--localstatedir=/home/MySQL/DATA \
--sysconfdir=/etc \
--with-mysqld-user=mysql \
--with-charset=euc_kr
/etc/ld.so.conf 에 내용추가
/usr/lib/mysql <--추가
ldconfig
=========================================
make && make install
mkdir -p /home/MySQL/DATA
/usr/local/mysql/bin/mysql_install_db
useradd -M -o -r -d /home/MySQL/DATA -s /sbin/nologin -c "MySQL Server" -u 27 mysql >/dev/null 2>&1
install -m 644 ./include/my_config.h /usr/local/mysql/include/mysql
mkdir -p /var/run/mysqld
chmod 0755 /var/run/mysqld
chown mysql:mysql /var/run/mysqld
rm -f /usr/local/mysql/share/mysql/mysql-*.spec
rm -f /usr/local/mysql/share/mysql/mysql-log-ratate
strip /usr/local/mysql/libexec/mysqld
ldd /usr/local/mysql/libexec/mysqld
chown -R mysql.mysql /home/MySQL/DATA
cp ./support-files/my-huge.cnf /etc/my.cnf
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --level 3 mysqld on
chkconfig --list (체크하세요. 부팅시 자동으로 올라오게 함)
/etc/profile 수정(패스설정)
-------
# /etc/profile
# mysql config
PATH="$PATH:/usr/local/mysql/bin"
---------
내용삽입
path는 로그아웃한 후 다시 로그인하면 반영됨.
/etc/rc.d/init.d/mysqld start
끝
3. 중요 패키지설치
(1) zlib 소스설치하기
http://www.zlib.net/
wget http://www.zlib.net/zlib-1.2.3.tar.gz
cd zlib-1.2.3
기존 rpm 그대로 둘것 (삭제하면 안됨)
./configure -s --prefix=/usr/local/zlib-1.2.3
make libdir=/usr/lib64
make test
make libdir=/usr/lib64 install
vi /etc/ld.so.conf
---
include ld.so.conf.d/*.conf
/usr/X11R6/lib
/usr/local/lib
---
내용수정
ldconfig
==================================================
error) /usr/local/lib/libz.a 에러
mv /usr/local/lib/libz.a /usr/local/lib/_libz.a 로 rename 후
make clean / config-make-로 다시 진행
==================================================
(2) libpng 설치
png 포맷을 다루기 위한 라이브러리입니다.
http://ftp.superuser.co.kr/pub/etc/libpng-1.2.10.tar.bz2
bzip2 -d libpng-1.2.10.tar.bz2
tar xvfp libpng-1.2.10.tar
[root@localhost local]# cd libpng-1.2.10
기존 rpm들은 그대로 둘것 (삭제하면 안됨)
[root@localhost libpng-1.2.5]# cp scripts/makefile.linux makefile
[root@localhost libpng-1.2.5]# make test && make install
[root@localhost libpng-1.2.5]# cd ..
(3) freetype 2 설치
글짜를 그릴 때 쓰는 라이브러리 입니다.
wget http://ftp.superuser.co.kr/pub/etc/freetype-2.2.1.tar.bz2
bzip2 -d freetype-2.2.1.tar.bz2
tar xvfp freetype-2.2.1.tar
[root@localhost local]# cd freetype-2.2.1
./configure --prefix=/usr/local/freetype-2.2.1 && make && make install
------------------------------
에러가 남 : 참고용
error) ft2build.h' hasn't been included yet!
vi /usr/include/freetype2/freetype/freetype.h
상단
#error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files."
#error "Example:"
#error " #include <ft2build.h>"
#error " #include FT_FREETYPE_H"
이 줄 삭제처리후에 다시 수행
-------------------------------
(4) libjpeg 설치
jpg 포맷을 다루는 라이브러리 입니다.
[root@localhost local]# wget http://ftp.superuser.co.kr/pub/etc/jpegsrc.v6b.tar.gz
[root@localhost local]# tar xvfz jpegsrc.v6b.tar.gz
[root@localhost local]# cd jpeg-6b
rpm -qa|grep libjpeg
[root@localhost jpeg-6b]# ./configure --enable-shared --enable-static --prefix=/usr/local/jpeg-6b
[root@localhost jpeg-6b]# make && make test
[root@localhost jpeg-6b]# make install <-- 에러발생할 것임
mkdir -p /usr/local/jpeg-6b/bin
mkdir -p /usr/local/jpeg-6b/include
mkdir -p /usr/local/jpeg-6b/lib
mkdir -p /usr/local/jpeg-6b/man/man1
등등... 없다는 폴더는 만들어줄것
[root@localhost jpeg-6b]# make install
[root@localhost jpeg-6b]# cd ..
위 설치법에서 특별한 것은 중간에 /usr/local/man/man1이라는 디렉토리를 생성합니다. 이유는 make install 하면 /usr/local/man/man1 디렉토리가 없다고 멘 페이지가 설치가 되지 않는다는 에러가 납니다.
(5) gd 설치
그래픽 라이브러리 입니다.
wget http://ftp.superuser.co.kr/pub/etc/gd-2.0.33.tar.gz
[root@localhost local]# tar xvzfp gd-2.0.33.tar.gz
[root@localhost local]# cd gd-2.0.33
[root@localhost gd-2.0.33]# ./configure --prefix=/usr/local/gd-2.0.33 --with-jpeg=/usr/local/jpeg-6b/ --with-freetype=/usr/local/freetype-2.2.1/
[root@localhost gd-2.0.33]# make && make install
4. 아파치의 설치
wget http://ftp.kaist.ac.kr/Apache/httpd/apache_1.3.41.tar.gz
64bit 에서는 -fPIC 옵션을 반드시 줘야 shared object 가 64bit로 된다.
검사법 : file /usr/local/apache/libexec/mod_env.so - 64bit x86-64표시되는지 확인할것
tar xvfzp apache_1.3.41.tar.gz
cd apache_1.3.41
export CFLAGS="${CFLAGS} -fPIC -DHARD_SERVER_LIMIT=1024 -DDEFAULT_SERVER_LIMIT=1024"
./configure --prefix=/usr/local/apache --enable-rule=SHARED_CORE --enable-module=so --enable-shared=max
make && make install
아파치의 설치스크립트 복사완료
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
참고사항) 모듈추가하기
기본으로 설치되는 모듈들
-rw-r--r-- 1 root root 7587 Jul 21 08:56 httpd.exp
-rwxr-xr-x 1 root root 5543 Jul 21 08:56 libhttpd.ep
-rwxr-xr-x 1 root root 357628 Jul 21 08:56 libhttpd.so
-rwxr-xr-x 1 root root 9814 Jul 21 08:56 mod_access.so
-rwxr-xr-x 1 root root 8164 Jul 21 08:56 mod_actions.so
-rwxr-xr-x 1 root root 10776 Jul 21 08:56 mod_alias.so
-rwxr-xr-x 1 root root 6099 Jul 21 08:56 mod_asis.so
-rwxr-xr-x 1 root root 11160 Jul 21 08:56 mod_auth.so
-rwxr-xr-x 1 root root 28787 Jul 21 08:56 mod_autoindex.so
-rwxr-xr-x 1 root root 14864 Jul 21 08:56 mod_cgi.so
-rwxr-xr-x 1 root root 7401 Jul 21 08:56 mod_dir.so
-rwxr-xr-x 1 root root 7212 Jul 21 08:56 mod_env.so
-rwxr-xr-x 1 root root 16484 Jul 21 08:56 mod_imap.so
-rwxr-xr-x 1 root root 36685 Jul 21 08:56 mod_include.so
-rwxr-xr-x 1 root root 16988 Jul 21 08:56 mod_log_config.so
-rwxr-xr-x 1 root root 15126 Jul 21 08:56 mod_mime.so
-rwxr-xr-x 1 root root 28782 Jul 21 08:56 mod_negotiation.so
-rwxr-xr-x 1 root root 9746 Jul 21 08:56 mod_setenvif.so
-rwxr-xr-x 1 root root 17913 Jul 21 08:56 mod_status.so
-rwxr-xr-x 1 root root 8426 Jul 21 08:56 mod_userdir.so
총 20개
추가해줘야 하는것들
1. libphp4.so : php4
2. mod_bandwidth.c
3. mod_gzip.c
4. mod_headers.c
5. mod_rewrite.c
6. mod_throttle.c
7. mod_url.c
이상 7개
설치하기
1. libphp4.so : 이 것은 php4가 설치되면 아래에서 자동설치됨
2. mod_bandwidth.c를 구해서 설치한다. (웹호스트 자료실에 있습니다)
3. mod_gzip.c (웹호스트자료실에 있습니다)
4. mod_headers.c (웹호스트 자료실에 있습니다)
5. mod_rewrite.c : src/modules/standard/ 폴더에 있습니다.(아파치소스폴더)
6. mod_throttle.c : 웹호스트자료실에 있습니다
7. mod_url.c : 웹호스트자료실에 있습니다.
------------------------------------------------------
- 아파치소스밑에 모듈들이 있다. 확장자 *.c 참조할것
- 2개는 별도로 구할것 mod_throttle.c 와 mod_bandwidth.c 는 yahoo.com에서 구할수 있다.
- 모듈 추가하는 법 (DSO방식에서)
/usr/local/apache/bin/apxs -i -a -c ./mod_bandwidth.c
참고) apache DSO vs static 방식의 차이점을 이해할것 - 되도록 DSO로 설치권장~
--------------------------------------------------------
5. php4 의 설치 (php4 설치방식 동일합니다)
php 컴파일을위한 모듈경로 변경 (64bit용)
cd /usr/lib
mv libjpeg.so libjpeg.so__
ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
mv libexpat.so libexpat.so__
ln -s /usr/lib64/libexpat.so /usr/lib/libexpat.so
mv /usr/local/lib/libz.a /usr/local/lib/libz.a__
ln /usr/lib64/libz.a /usr/local/lib/libz.a
mv /usr/lib/libssl.a /usr/lib/libssl.a__
ln /usr/lib64/libssl.a /usr/lib/libssl.a
wget http://ftp.superuser.co.kr/pub/php/php-4.4.4.tar.gz
tar xvzfp php-4.4.4.tar.gz
cd php-4.4.4
첫번째방법은 gd까지 모두 포함해서 설치하는 것이다.
관련 패키지를 아래 apm문서를 보고 모두 설치하라. gd, zlib, jpeg등등...
주의 : zlib-1.2.3 일때~
install.sh 라는 파일을 하나 만든다.
vi install.sh
./configure --prefix=/usr/local/php \
--libdir=/usr/lib64 \
--with-apxs=/usr/local/apache/bin/apxs \
--with-exec-dir=/usr/local/apache/bin \
--with-config-file-path=/usr/local/php/lib \
--with-mysql=/usr/local/mysql \
--with-zlib \
--with-gd \
--with-gd-dir=/usr/local/gd-2.0.33 \
--with-jpeg-dir=/usr/local/jpeg-6b \
--with-png \
--with-freetype-dir=/usr/local/freetype-2.2.1 \
--with-openssl \
--with-mod_charset \
--with-language=korean \
--with-charset=euc_kr \
--with-gdbm \
--with-ldap \
--with-xml \
--with-regex=php \
--with-iconv \
--with-gettext \
--enable-module=so \
--enable-memory-limit \
--enable-track-vars \
--enable-ftp \
--enable-sockets \
--enable-trans-sid \
--enable-magic-quotes \
--enable-sysvsem \
--enable-sysvshm \
--enable-mailparse \
--enable-sigchild \
--enable-calender \
--enable-inline-optimization \
--disable-debug \
--enable-mbstring
저장하고 빠진후
chmod 700 install.sh
./install.sh
utf8로 설치시 --with-charset=utf8 \ 수정할것
두번째는 이 중 간략하게만 설치하는 방법이다.
make && make install
cp php.ini-dist /usr/local/apache/conf/php.ini
[ zend의 설치 ]
zend.com 에서 64bit 용 tar.gz을 다운로드한다.
- 상단 download 클릭
- 가입하고 다운할것
tar xvzfp ZeodOptimizer-3.3.2....tar.gz
cd ZendOptimizer-3.3.2....
./install.sh - 진행에 따라 php.ini 를 복사한 /usr/local/apache/conf 입력해줄것
나머진 Next 엔터로 진행
이제
chkconfig --level 3 httpd on
하면 에러가 발생한다. 이것을 해결하기 위해서
vi /etc/rc.d/init.d/httpd
제일 하단에 아래 3줄을 삽입하고 저장하자.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description: A very fast and reliable WebServer engine.
다시
chkconfig --level 3 httpd on
OK
이상 64bit APM 설치문서 끝.
작성 : (주)웹호스트 http://www.webhost.co.kr
작성 : 2009-02-09
/usr/bin/ld: /usr/local/ssl/lib/libssl.a(s2_srvr.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
이런 오류가 발생할 경우.. 64bit 에서 configure 에 추가해야 할 사항이 있다.
위의 경우 64bit OS 에서 mod-ssl 을 지원 하기 위해 compile 을 할때 나타나며
해결 방법은 다음과 같다.
./config -fPIC && make && make install
www.openssl.or.kr 에서는 -fPIC 옵션에 대해 다음과 같이 설명한다.
./config -fPIC로 해야지만, DSO판 작성시에 필요한 PIC(Postion Independent Code) 옵션을 지정해 configure 한다.
아래의 예제 소스를 응용하시면 제작이 가능합니다.
레이어를 보였다 안보였다 하는 방법 입니다.
▶ 소스
아래의 --------- 사이의 파란 글씨의 내용이 소스입니다..
------------------------------------------------------------
<style type="text/css">
<!--
A:link {font-family: 굴림체; font-size:9pt; text-decoration: none;}
A:visited {font-family: 굴림체; font-size:9pt; text-decoration: none;}
A:hover {font-family: 굴림체; font-size:9pt;text-decoration:overline underline;}
-->
</style>
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr><td height="25">
<A href="문서1의 주소" onmouseover="MM_showHideLayers('menu1','','show','menu2','','hide')">메뉴1</A>
<A href="문서5의 주소" onmouseover="MM_showHideLayers('menu1','','hide','menu2','','show')">메뉴2</A>
</td></tr>
</table>
<div id="menu1" style="position:
<A href="문서1의 주소">문서1</a>
<A href="문서2의 주소">문서2</a>
<A href="문서3의 주소">문서3</a>
<A href="문서4의 주소">문서4</a>
</div>
<div id="menu2" style="position:
<A href="문서5의 주소">문서5</a>
<A href="문서6의 주소">문서6</a>
</div>
------------------------------------------------------------
▶ 소스 설명
1.
<style ~~> 부터 </style> 태그까지는 링크된 글씨폰트, 글씨크기, 밑줄, 윗줄 등에 대한 스타일 지정입니다.
2.
<table ~~> 부터 </table> 태그까지는 메뉴로 사용하는 레이어와 테이블을 이용한 부메뉴 부르기입니다.
참고) 레이어?
HTML 문서에서 레이어(Layer)란 화면 어디든 사용자가 나타나는 위치를 지정할 수 있는 문단을 말합니다. 레이어는 화면에서 안보이게 숨기거나 나타낼 수 있으며 크기도 지정할 수 있습니다.
3.
<script ~~> 부터 </script> 태그까지는 상위 메뉴를 눌렀을 때 상위 메뉴의 아래에 가로로 부메뉴 나타나게 하는 자바스크립트입니다.
4.
<A href="문서1" onmouseover="MM_showHideLayers('menu1','','show','menu2','','hide')">메뉴1</A>
주메뉴의 부메뉴를 부르는 명령입니다.
menu1이라는 부메뉴(<div> ~ </div> 태그로 만든 레이어의 내용들)를 보여주고(show) id가 "menu2"인 부메뉴 레이어는
감추라는(hide) 명령입니다.
주메뉴에 마우스를 올렸을 때 부메뉴로 나타내고 싶은 레이어를 MM_showHideLayers()에서 '레이어 ID','','show'처럼
지정을 하고 다른 부메뉴 레이어들은 화면에 안보이게 '레이어 ID','','hide'로 숨겨줍니다.
만약 주메뉴와 부메뉴가 각각 3개이고 각 부메뉴 레이어의 id가 menu1, menu2, menu3이라면 마우스가 주메뉴나
부메뉴 중 어느 곳에 위치해 있다가 다른 주메뉴를 선택할 때 항상 선택한 주메뉴의 부메뉴만이 화면에 나타나야 합니다.
안그러면 레이어들이 화면에 겹쳐서 잘 안보일 수 있기 때문입니다.
이런 경우에는 MM_showHideLayers()에서 '레이어 ID','','hide','레이어 ID','','hide'처럼
다른 부메뉴 레이어들은 모두 숨깁니다.(hide)
그런 후 '레이어 ID','','show'로 화면에 나타낼 부메뉴 레이어를 show를 해줍니다. show와 hide 하는 것은
어느 것을 먼저 하느냐는 상관없습니다.
예)
onmouseover="MM_showHideLayers('menu1','','show','menu2','','hide','menu3','','hide')" 이것과 onmouseover="MM_showHideLayers('menu2','','hide'.'menu3','','hide','menu1','','show')" 이것처럼 show 되는 부메뉴를 먼저 써줘두 되고 hide 되는 부메뉴를 먼저 써주든 상관 없습니다. 단, '레이어 ID', '', 'show 또는 hide' 라는 형식은 지켜야 합니다. |
<script language="JavaScript">
function hiddn_layer(layer_name)
{
if (layer_name == '') return;
eval(layer_name+".style.display='none'")
}
function show_layer(layer_name)
{
if (layer_name == '') return;
eval(layer_name+".style.display='block'")
}
</script>
<a href='#' OnClick="show_layer('layer01'); hiddn_layer('layer02');">메뉴1</a> <a href='#' OnClick="hiddn_layer('layer01');show_layer('layer02');">메뉴2</a>
<div id="layer01" style='display:none;'>1 부메뉴1 | 1 부메뉴2 | 1 부메뉴3 | 1 부메뉴4</div>
<div id="layer02" style='display:none;'>2 부메뉴1 | 2 부메뉴2 | 2 부메뉴3 | 2 부메뉴</div>
<script language="JavaScript">
<!--
function reSizePopup(){
window.resizeTo(512, document.body.scrollHeight+30);
}
//-->
</script>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" bgcolor="#EBE3D7" onload="reSizePopup()">
Some examples follow how to send cookies:
Example #1 setcookie()>$2 send example
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", ".example.com", 1);
?>
Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same name as the cookie name. If you don't want this, you can use setrawcookie() instead if you are using PHP 5. To see the contents of our test cookie in a script, simply use one of the following examples:
<?php
// Print an individual cookie
echo $_COOKIE["TestCookie"];
echo $HTTP_COOKIE_VARS["TestCookie"];
// Another way to debug/test is to view all cookies
print_r($_COOKIE);
?>
Example #2 setcookie()>$2 delete example
When deleting a cookie you should assure that the expiration date is in the past, to trigger the removal mechanism in your browser. Examples follow how to delete cookies sent in previous example:
<?php
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".example.com", 1);
?>
Example #3 setcookie()>$2 and arrays
You may also set array cookies by using array notation in the cookie name. This has the effect of setting as many cookies as you have array elements, but when the cookie is received by your script, the values are all placed in an array with the cookie's name:
<?php
// set the cookies
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
// after the page reloads, print them out
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $value) {
echo "$name : $value <br />\n";
}
}
?>
The above example will output:
three : cookiethree two : cookietwo one : cookieone
usermod
사용자 계정정보를 수정하는 명령어이다.
기존에 생성되어 있는 계정사용자의 다음과 같은 계정정보들을 수정할 수 있다.
사용형식
usermod [-c comment] [-d home_dir [ -m]]
[-e expire_date] [-f inactive_time]
[-g initial_group] [-G group[,...]]
[-l login_name] [-p passwd]
[-s shell] [-u uid [ -o]] [-L|-U] login
사용예 #1
다음은 sspark5라는 계정사용자의 /etc/passwd, /etc/shadow, /etc/group내에 설정된 기본 설정내용이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508::/home/sspark5:/bin/bash
[root@host3 root]#
[root@host3 root]# grep sspark5 /etc/shadow
sspark5:$1$/H.bOlGk$jeEdF1g7naK9vVe4v5i/s/:12314:0:99999:7:::
[root@host3 root]#
[root@host3 root]# grep sspark5 /etc/group
sspark5:x:508:
[root@host3 root]#
위의 초기 설정값을 간단히 보면 UID는 506, GID는 508, 코멘트는 현재 없으며, 홈디렉토리는 /home/sspark5이며, 사용하는 기본쉘은 bash쉘임을 알 수 있다.
이제 이 값들을 usermod로 바꾸어 보도록 하자.
먼저, sspark5사용자의 코멘트를 입력해 보자.
[root@host3 root]# usermod -c 박성수 sspark5
[root@host3 root]#
위의 예와 같이 코멘트를 수정하는 usermod의 옵션은 -c이다.
다음은 /etc/passwd내에 sspark5의 변경된 코멘트를 확인한 것이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508:박성수:/home/sspark5:/bin/bash
[root@host3 root]#
사용예 #2
이번에는 sspark5사용자의 홈디렉토리를 변경해보자.
usermod에서 홈디렉토리를 변경하는 옵션은 -d이다.
[root@host3 root]# usermod -d /usr/sspark5 sspark5
[root@host3 root]#
위와 같이 홈디렉토리를 변경하였다.
다음은 변경된 값을 확인한 것이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508:박성수:/usr/sspark5:/bin/bash
[root@host3 root]#
한가지 주의할 것은 홈디렉토리의 위치가 변경되었지만 원래 있던 홈디렉토리파일들이 삭제되거나 이동되는 것은 아니다.
원래의 홈디렉토리내에 존재하는 파일들은 모두 그대로 존재한다.
사용예 #3
이번에는 -e옵션을 사용하여 sspark5의 계정 종료일을 설정해보자.
[root@host3 root]# usermod -e 2006-12-31 sspark5
[root@host3 root]#
위와 같이 설정한 후에 /etc/shadow파일을 확인한 것이다.
계정 종료일의 설정은 위에서 보았던 /etc/shadow파일의 내용과는 달리 '13513"이 설정되어 있는 거을 알 수가 있다.
[root@host3 root]# grep sspark5 /etc/shadow
sspark5:$1$/H.bOlGk$jeEdF1g7naK9vVe4v5i/s/:12314:0:99999:7::13513:
[root@host3 root]#
사용예 #4
이번에는 sspark5의 기본사용쉘을 변경해 보자.
sspark5의 원래 사용했던 기본사용쉘은 /bin/bash(Bash Shell)이였다.
이것을 usermod로 다음과 같이 /bin/csh(C Shell)로 변경한 것이다.
[root@host3 root]# usermod -s /bin/csh sspark5
[root@host3 root]#
이를 확인하기 위하여 /etc/passwd의 내용을 확인하였다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508:박성수:/usr/sspark5:/bin/csh
[root@host3 root]#
사용예 #5
이번에는 sspark5의 UID를 변경해 보자.
UID를 변경하기 위해서는 -u옵션을 사용하면 된다.
[root@host3 root]# usermod -u 508 sspark5
[root@host3 root]#
원래 sspark5의 UID는 506이였던 것을 508로 변경한 것이다.
다음은 변경된 UID값을 확인한 것이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:508:508:박성수:/usr/sspark5:/bin/csh
[root@host3 root]#
이상과 같이 usermod에 대해서 살펴보았다.
usermod명령어는 useradd, useradd -D, userdel과 함께 익혀두는 것이 바람직한다.
여러분들의 건투를 빈다.
useradd 옵션
-d /user/id --> 홈디렉토리 위치를 /user/id 로 지정함
-u 2000 --> UID 를 2000 으로 지정함
-s /bin/sh --> id 사용자가 기본으로 사용할 쉘 종류를 C쉘로 지정함
-c I'm a man --> 계정사용자의 간단한 코멘트
-e 2009-09-03 --> id의 계정사용기간
-p 1234 --> id의 기본 패스워드
siidc --> 생성할 계정명
1번) useradd -d /home/xnote -u 2000 -s /bin/sh -c NOTEBOOK -e 2007-11-11 -p 1 siidc
ex) useradd -u 1000 -g web -d /user/web -s /bin/sh
2번) useradd에 관한 사용자 생성 및 관리 를 하는 (3개의 파일 _ 디렉토리)
cat /etc/default/useradd--->해당 추가유져 에 대하여 세부적으로 설정가능
cat /etc/login.defs--->메일디렉토리/패스워드기간및알림/UID/GID설정
cat /etc/skel--->계정생성시 자동복사 되는 원본 디렉토리
# useradd defaults file
GROUP=100---> 소속될 그룹의 GID
HOME=/home/web---> 사용자의 홈디렉토리위치
INACTIVE=-1---> 사용자의 패스워드 종료일수 이후의 유효기간
EXPIRE=---> 앞으로 추가 되는 계정들의 종료일수 “2010-10-30” 라고 함
SHELL=/bin/bash---> 기본쉘로 사용할 쉘의 종류이다.
SKEL=/etc/skel---> 새로 생성되는 사용자의 홈디렉토리로 복사될 초기환경파일들이 저장된 디렉토리 지정하는곳
※ 리눅스 는 2번 예제로 설정하는 것보다 1번 예제로 설정하였는것 을 우선으로 함! ※
\
일단 사운드포지를 실행합니다.
미리 준비한 mp3 음악파일을 file->open 으로 불러들입니다.
마우스로 원하는 부분을 드래그하여 선택합니다.
플레이 버튼을 눌러 들어보면서 위치를 정하면 되겠습니다.
(아, 이 때 상하 두 부분으로 나뉘어져 있을 텐데요, 두 부분 모두 포함해서 드래그해주세요)
필요한 부분을 선택했으면 edit->copy 로 가셔서 선택 영역을 복사합니다.
복사를 했으면 file-new를 누릅니다.
기본 설정값이 주어진대로 ok 버튼을 누릅니다.
새로운 창이 떴군요. 이곳에 아까 선택한 영역을 붙여넣습니다.(edit->paste)
여기까지 되셨죠?
프로세스로가서 본격적으로 다듬어 봅시다.
Process-Channel Converter를 누릅니다.
현재 스테레오인 샘플을 모노로 바꿔줘야 합니다. mmf는 모노만 지원을 하기 때문입니다.
Stereo to Mono 50%(no faders)를 선택합니다. 선택하시고 ok를 누르세요
그 다음 이퀼라이져를 조절합니다. 안 해도 됩니다.
하지만 좋은 음질의 벨소리를 만들기위해선 eq조절은 필수!
Process - EQ - Graphic을 선택합니다.
위와 같이 맞춰주면 됩니다(아마도)
볼륨은 조금 이따 조절하도록 하고 일단은 다음의 작업 먼저 하시죠.
프로세스에서 리샘플(Process - Resample) 조절합니다.
mmf 변환기에서 샘플값을 최대 24000 까지 지원하기 때문에 24000을 넘으면 에러가 납니다.
cd음질이 44100 정도 됩니다. 24000이면 훌륭합니다.
우리는 24000으로! 용량을 줄이고 싶으시다면 이 값을 낮게 설정해주시면 됩니다. (대신 음질저하)
24000 으로하고 ok
이제 볼륨을 높입니다. Process - Volume을 선택합니다.
그래프 위/아래가 짤리지 않는 한도 내에서 크게 볼륨을 설정해 주세요
만약 짤린다면 볼륨을 낮춰주셔도 괜찮습니다
그래프 위 아래가 짤렸을 때 컴퓨터에서 들어보면 꽤 괜찮습니다.
하지만 벨소리로 만들고 들어보면 상당히 귀에 거슬리죠.
이제 노래 끝 2초 정도를 선택합니다. 노래 소리가 줄어들면서 끝나는 효과를 주기 위해서인데요...
이걸 안 하면 역시 상당히 귀에 서슬립니다. 노래 나오다가 갑자기 짤리는 것 같거든요.
프로세스의 페이드아웃(Process - Fade - Out)을 선택합니다.
마지막 부분의 소리가 점점 줄어들었습니다.
이렇게하면 벨소리에 필요한 부분은 완성된겁니다.
이제 저장을 합니다. (저장을 하고 이 저장된 파일을 mmf로 변환할 겁니다.)
Wave(Microsoft)를 선택합니다
scott 스튜디오 하시면 안되요.
파일이름을 적고 저장을 누르시면 끝납니다.
<mmf변환법>
Yamaha의 Wave Sound Decorator을 다운받으세요
File - Open으로 wav파일로 저장한 벨소리용 파일을 부릅니다
그리고 왼쪽 상단에 보시면 MA-1이라고 쓰여진 게 보이실 거에요
그걸 MA-5로 조절합니다.(64폴리일 경우)
그리고 File - Save us 하시면 끝납니다.
[출처] 사운드포지를 이용한 벨소리만들기|작성자 김지수
특정영역 인쇄하는 것을 자바스크립트로 하다가 먼가 깔끔하지 못한거 같아서 새로운 방법을 찾던중
이번에는 CSS (스타일시트) 로 인쇄영역을 구분하는 방법에 대해 할게 되었다.
이 방법은 media에 따라 스타일을 다르게 주는 방법으로,
이를 이용하면 화면에 보이는 스타일과 인쇄되는 스타일을 다르게 설정할 수 있다.
즉, 단순히 보이지 않는 것을 떠나서 색을 바꾼다던지 배경그림을 넣는 것, 폰트를 변경하는 것도 가능하다.
항상 장점이 있으면, 단점도 있는 법!!
이런 장점만큼이나 안타까운 단점이 있다.
자바스크립트로 구현할 때는 내가 인쇄하기를 원하는 부분만을 묶으면 되지만,
이는 반대로 인쇄를 하지 않을 부분을 묶어야 한다는 것이다.
이 방법이 때로는 장점이 될수도 있는 것이지만, 특정 페이지에서만 인쇄를 하고 홈페이지를 노프레임형태로 Server Side Include (PHP, ASP, Apache 등 서버단에서 Include 하는 것)을 사용한다면 변경해야될 파일이 많아진다.
하지만 모든 페이지에서 인쇄를 해야하고, 항상 특정부분을 제외해야 한다면 장점도 될수 있을 것이다.
이를 사용하는 방법은 아주 간단하다.
핵심코드는 아래 몇줄안되는 코드가 전부다.
이렇게 media="print"를 하면 인쇄할 때만 적용되고, media="screen"은 화면에 출력할 때만 적용이 된다.
위의 코드는 class="noprint" 가 지정되어 있는 영역은 프린트가 되지 않게 만들고,
반대로 class="onlyprint"가 지정되어 있는 영역은 화면에 출력되지 않게 한다.
그렇게 어려운 내용이 아니므로 아래 예제를 보면 충분히 이해할 수 있을 것이다.
예제보기
출처 - http://realmind.tistory.com/198 BSH님 블로그 펌
리눅스에서도 윈도우처럼 x-window을 원격제어 할 수 있다.
물론 여러가지 프로그램들이 있지만, 우선 여기에서 VNC를 이용하여 원격제어를
하고자 한다.
1. VNC SERVER가 설치가 되어있는지 확인을 해본다.
#rpm -qa|grep vnc vnc-server-4.1.2-9.el5 |
2. VNC가 설치가 되어 있다면 VNC 설정파일에서 사용자를 추가해준다.
#vi /etc/sysconfig/vncservers |
# The VNCSERVERS variable is a list of display:user pairs. # # Uncomment the lines below to start a VNC server on display :2 # as my 'myusername' (adjust this to your own). You will also # need to set a VNC password; run 'man vncpasswd' to see how # to do that. # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, see # <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>. # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # Use "-nohttpd" to prevent web-based VNC clients connecting. # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. VNCSERVERS="1:user" #이부분의 주석을 제고하고 사용하고자하는 사용자를 등록한다. 사용자앞은 숫자는 접속할때 필요한 것이므로 유의하여 등록한다. # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" |
3. VNC를 실행을 위한 준비작업.
- 환경설정
# vncserver :1 Starting VNC server: 1:user New 'linux.user:1(user)' desktop is linux.user:1 starting applications specified in /home/user/.vnc/xstartup Log file is /home/user/.vnc/linux.user:1.log |
위 명령을 실행하면 x-windows를 선택할 수 있는 필요 파일들이 생성된다.
= 아래 설정파일에서 빨간색으로 표시된 부분을 주석을 제거해줘야
GUI 원격제어를 할수가 있다.. 이게 주석처리되있으면 터미널모드만 실행가능한
원격제어가 된다..(그럴거면 SSH 접속 프로그램이 오히려 더 편하다..)
#vi ~/.vnc/xstartup |
#!/bin/sh # Uncomment the following two lines for normal desktop unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & twm & |
- VNC 실행
실행된 VNC 서버가 있다면 설정을 변경한후 재기동을 해준다. 이때 재기동을 해주어야 변경된 환경설정되로 변경된다.
[root@ ~] service vncserver restart
#vncserver -kill :1 Killing Xvnc process ID 1234 |
#vncserver :1 Starting VNC server: 1:user New 'linux.user:1 (user)' desktop is linux.user:1 starting applications specified in /home/user/.vnc/xstartup Log file is /home/user/.vnc/linux.user:1.log |
이제 모든작업을 완료하였다.
그럼 이제 클라이언트에서 접근해보자.
출처 : http://ggwangs.egloos.com/870506
각 사용자 별로 트래픽을 관리한다는것은 FTP 웹서비스 다 포함하는걸 원하시는건가요?
각 사용자의 모든 서비스 트래픽을 제어하는것은 저도 모르겠습니다.
다만 요즘 트래픽 제한 이라고 하면 거의 대부분이 웹서비스(아파치에서...)를 제어하는
것을 말하기에 대략 설명드리겠습니다.
웹호스팅 사이트를 돌아다니다보면
' 일일트래픽 500M , 혹은 일일 히트수 1000 히트 제한 '
이런 글을 볼 수 있습니다.
트래픽을 제어하는 방법은 mod_bandwidth 와 mod_throttle 두가지가 주로 많이 쓰이는데
mod_bandwidth 는 대역폭을 관리 하는 모듈이며
mod_throttle 은 트래픽을 제어하는 모듈입니다 ( 그게 그 소리 같은가 ? ㅡㅡ;; 하지만 두개의
역할은 분명히 다릅니다 )
예를들어 1M 짜리 파일을 받는다고 하면
mod_bandwidth 모듈을 이용하면 초당 얼마의 속도까지 전송이 가능한지를 관리 하고
mod_throttle 모듈은 1M 파일을 몇번까지 다운받을 수 있느냐를 관리 하게 되겠죠.
mod_bandwidth 모듈은 1M 파일을 다운 받는 속도를 apache 서버 관리자가 마음대로
조절할 수 있으나 다운 받는 횟수, 다시말해 총 다운로드 양은 조절이 안되고
mod_throttle 모듈은 1M 파일을 다운받는 속도를 조절할 수 없으나
다운받는 총 횟수, 즉 총 다운로드 양을 조절할 수 있다는 말입니다.
두개를 함께 쓰면 트래픽, 대역폭 관리에 유용하겠죠.
이번 강좌에서는 mod_throttle 모듈만 설명 하겠습니다.
아파치가 설치된 디렉토리는 /usr/local/apache 라고 가정하고 설명 합니다.
우선 mod_throtte.c 파일을 다운받아 아파치 경로의 특정 디렉토리로 가져다 놓습니다.
이걸 구할 수 있는곳은
http://www.snert.com/Software/mod_throttle/index.shtml
위 웹사이트입니다.
mod_throttle312.tgz 파일을 다운 받을 수 있네요 ( 2003년 10월 25일 현재 )
다운받아 압축을 풀면 여러개의 파일이 나오는데 그 중에서
mod_throttle.c 파일을 /usr/local/apache/src/module/extra 에 가져다 놓습니다.
그리고 아파치를 컴파일을 다시 하는데
아래와 같은 컴파일 옵션을 줘야 합니다.
[root@myserver /]# cd /usr/local/apache
[root@myserver apache]# ./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a --add-module=src/modules/extra/mod_throttle.c
( 여기서 \ 표시는 줄이 바뀌며 라인이 지저분해 지는것을 방지 하기 위해
줄을 넘기면서 명령어를 계속해서 입력하기 위해 사용한 표시입니다 )
기존의 php 연동 옵션 (activate... ) 아래에 모듈을 함께 컴파일 하는것으로 옵션을 주었습니다.
이제 make 그리고 make install 로 컴파일을 합니다. ( 이 부분은 아래글 apache ,PHP 설치하기를
참조하시길 바랍니다 )
컴파일이 완료 되었으면 모듈이 제대로 추가 되었는지 확인해 봅니다.
[root@myserver apache]# /usr/local/apache/bin/httpd -l
Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_access.c
mod_auth.c
mod_setenvif.c
mod_php4.c
mod_throttle.c
suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec
맨 아래쪽에 mod_throttle.c 라는 모듈이 보입니다.
제대로 컴파일이 된 상태입니다.
이제 모듈을 사용해 보겠습니다.
httpd.conf 파일을 열어서
( 꼭 거기에다 편집할 필요는 없지만 .. 같은 내용은 몰아 넣는것이 관리하기 좋겠죠 )
아래의 내용을 입력합니다.
ThrottlePolicy none
SetHandler throttle-status
Deny from all // 다른접근을 모두 거부하고
Allow from 123.123.123.123 // 특정 아이피에서만 throttle-status 를 확인 하도록
SetHandler throttle-me
Order deny,allow
Deny from all
Allow from all
SetHandler throttle-me
throttle-status 를 확인할 수 있는 아이피를 정해 놓은 부분(Allow from.. )을 주의 하시길 바랍니다.
아무나 서버 상태를 확인하게 하면 좇치 않겠지요 ? ㅋㅋ
위 설정은 123.123.123.123 에서만 서버 전체의 트래픽 상황을 모니터링 하도록 설정한 것입니다.
virtualhost 에서의 설정은 아래와 같습니다.
ServerAdmin dream@praise.co.kr
DocumentRoot /home/dream/public_html
ServerName myserver.co.kr
ServerAlias www.myserver.co.kr
Throttle Policy Volume 1024M 1d // 1일 1G 제한
ThrottlePolicy Request 1000 1d // 하루 히트수 1000회 제한
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
위의 내용대로
서버에서 운영되는 도메인에 대해 throttlepolicy 를 설정한 뒤
아파치를 재시작 하고
http://서버IP/throttle-status 를 확인 하면
서버에 설정된 대역폭의 모든 내용을 확인 할 수 있으며
서버에 설정된 특정 도메인의 트래픽을 확인 하려면
http://domain/throttle-me 를 확인 하면 됩니다.
-----------------------------------------------------------------------
자료출처 : 진우네집 ( http://www.praise.co.kr )
-----------------------------------------------------------------------
<a href="#" onClick="window.open('새창으로 열릴 주소'); window.print()">누르세요</a>
경우 2. 새창을 띄우고 새창을 인쇄하는 방법
새창이 아닌 현재창에 들어갈 소스: <a href="#" onClick="window.open('새창으로 열릴 주소')">누르세요</a>
새창에 들어갈 소소: <body onLoad="window.print()">
01 |
var initBody; |
02 |
function beforePrint() |
03 |
{ |
04 |
initBody = document.body.innerHTML; |
05 |
document.body.innerHTML = print_page.innerHTML; |
06 |
} |
07 |
|
08 |
function afterPrint() |
09 |
{ |
10 |
document.body.innerHTML = initBody; |
11 |
} |
12 |
|
13 |
function pageprint() |
14 |
{ |
15 |
window.onbeforeprint = beforePrint; |
16 |
window.onafterprint = afterPrint; |
17 |
window.print(); |
18 |
} |
1 |
< div id = 'print_page' > |
2 |
인쇄내용 |
3 |
</ div > |
1 |
< input type = 'button' value = ' 인 쇄 ' onclick = "pageprint()" > |
01 |
function pagePrint(Obj) { |
02 |
var W = Obj.offsetWidth; //screen.availWidth; |
03 |
var H = Obj.offsetHeight; //screen.availHeight; |
04 |
|
05 |
var features = "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=" + W + ",height=" + H + ",left=0,top=0" ; |
06 |
var PrintPage = window.open( "about:blank" ,Obj.id,features); |
07 |
|
08 |
PrintPage.document.open(); |
09 |
PrintPage.document.write( "<html><head><title></title><style type='text/css'>body, tr, td, input, textarea { font-family:Tahoma; font-size:9pt; }</style>\n</head>\n<body>" + Obj.innerHTML + "\n</body></html>" ); |
10 |
PrintPage.document.close(); |
11 |
|
12 |
PrintPage.document.title = document.domain; |
13 |
PrintPage.print(PrintPage.location.reload()); |
14 |
} |
1 |
< div id = 'print_page' > |
2 |
인쇄내용 |
3 |
</ div > |
1 |
< input type = 'button' value = ' 인 쇄 ' onclick = "pagePrint(document.getElementById('print_page'))" > |