perl multi comment 사용하기.

ITWeb/개발일반 2009. 1. 14. 10:48

참조문서 : http://perldoc.perl.org/perlpod.html

일반적으로 line comment 는 # 으로 사용한다.
그럼 multi-line comment 는 어케 할까?

문서를 찾아 보니.. 이와 같이 하는군요..

=pod
commenting....
commenting....
commenting....
.....
=cut

관련 상세 내용은 위에 문서 링크 보시면 됩니다.. ^^*

:

apache trace method

ITWeb/서버관리 2009. 1. 13. 15:38

TraceEnable Off

이 옵션은 cross-site tracing 공격에 노출 되는 문제와 더불어 basic 인증의 패스워드를 가로챌 수 있는 취약점이 있습니다.

trace method 가 꼭 필요한 것이 아니면 apache conf 설정 시 off 로 설정 하고 사용하세요.

또 다른 방법으로는 mod_rewrite 로 방지가 가능 합니다.

RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]

이렇게 하시면.. 403 forbidden 메시지가 떨어 집니다..
꼭 테스트는 해보세요.. ^^*

실제 어떻게 사용 하냐구요..

telnet localhost 80
TRACE / HTTP/1.0
와 같이 사용 하지요..

google 에 trace method 로 검색 하시면.. 좋은 정보 많이 나옵니다.. :)

:

apache DirectoryIndex 란?

ITWeb/서버관리 2009. 1. 9. 15:42
출처 : http://httpd.apache.org/docs/2.0/mod/mod_dir.html

DirectoryIndex 지시어

설명: 클라이언트가 디렉토리를 요청할때 찾아볼 자원 목록
문법: DirectoryIndex local-url [local-url] ...
기본값: DirectoryIndex index.html
사용장소: 주서버설정, 가상호스트, directory, .htaccess
Override 옵션: Indexes
상태: Base
모듈: mod_dir

DirectoryIndex 지시어는 클라이언트가 디렉토리명 끝에 /를 붙여서 디렉토리의 index를 요청할때 찾아볼 자원 목록을 지정한다. Local-url은 요청한 디렉토리에 상대적인 문서의 (%로 인코딩된) URL이다. 보통은 디렉토리에 있는 파일명이다. 여러 URL을 지정할 수 있고, 이 경우 서버는 첫번째로 찾은 파일을 보낸다. 자원을 찾을 수 없고 Indexes 옵션을 설정하였다면 서버는 직접 디렉토리 목록을 만든다.

예제

DirectoryIndex index.html

이 경우 http://myserver/docs/를 요청할때 http://myserver/docs/index.html이 있으면 이를 보내고, 없다면 디렉토리 목록을 보낸다.

문서가 반드시 디렉토리에 상대적일 필요는 없다.

DirectoryIndex index.html index.txt /cgi-bin/index.pl

이 경우 디렉토리에 index.html이나 index.txt가 없으면 CGI 스크립트 /cgi-bin/index.pl을 실행한다.


----------> 여기서 부터는 나의 해석.. ㅋ
그럼 이넘이랑..
RewirteRule ^/$   /index.html [R]
RewirteRule ^/$   /index.html [L]
이거랑 뭐가 다를까?
그리고 둘다 넣었을 경우 어떻게 응답을 할까?

우선 apache 에서는 RewriteRule 이 먼저 적용 된다.
이넘 들 실행 후에 암것도 없거나 그러면.. DirectoryIndex 를 찾는다..
어떤 경우에.. 파일 지정을 하지 않았거나 / 로 끝났을 경우에..

[R] 은.. access 로그를 보면 알겠지만.. request 두번 (302 한번, 200 한번)
[L] 은 access 로그에 처음 요청 URL 한번

그럼 이 [R], [L] 이건 또 뭐야??
아파치 문서에는 이렇게 되어 있다..

출처 : http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

'redirect|R [=code]' (force redirect)
Prefix Substitution with http://thishost[:thisport]/ (which makes the new URL a URI) to force a external redirection. If no code is given, a HTTP response of 302 (MOVED TEMPORARILY) will be returned. If you want to use other response codes in the range 300-400, simply specify the appropriate number or use one of the following symbolic names: temp (default), permanent, seeother. Use this for rules to canonicalize the URL and return it to the client - to translate ``/~'' into ``/u/'', or to always append a slash to /u/user, etc.
Note: When you use this flag, make sure that the substitution field is a valid URL! Otherwise, you will be redirecting to an invalid location. Remember that this flag on its own will only prepend http://thishost[:thisport]/ to the URL, and rewriting will continue. Usually, you will want to stop rewriting at this point, and redirect immediately. To stop rewriting, you should add the 'L' flag.

  • 'last|L' (last rule)
    Stop the rewriting process here and don't apply any more rewrite rules. This corresponds to the Perl last command or the break command in C. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. For example, use it to rewrite the root-path URL ('/') to a real one, e.g., '/e/www/'.
  • 그렇군.. 뭔 말인지 알지?? ^^;; ㅋ
    뭐 말 그대로 인고.. redirect 근데 이넘은.. URL 도 같이 변경이 되고..
    last 는 기냥.. 여기서 그만.. 더 이상 하위 rule 은 실행을 하지 않는 다는 의미 이지요..
    그럼 이넘은.. 왜 R 처럼 URL 이 바뀌지는 않는 걸까? 설명에 있잖아..

    ㅎㅎ 그럼.. 이건 여기서 이제 그만.. ㅎㅎ

    :

    [펌]웹페이지 성능 향상

    Legacy 2009. 1. 7. 13:30

    http://msdn.microsoft.com/ko-kr/magazine/dd188562.aspx

     

    한번 가볍게 읽어 보세요. ^^*

     

    1.      충분한 포트 열기

    2.      다운로드하는 작은 파일 수를 제한

    3.      JavaScript 파일을 JavaScript 엔진 외부에서 로드

    4.      연결 유지 사용

    5.      네트워크 정체 현상 식별

    6.      네트워크 MTU(최대 전송 단위) TCP 크기 늘리기

    7.      서버 정체 현상 식별

    8.      불필요한 왕복 확인

    9.      만료 날짜 설정

    10.  리디렉션에 대한 재고

    11.  압축 사용

    12.  CSS 편집

     

    더불어 비교해서 야후 닷컴에 근무하는 친구(제 친구는 아니구요.. )가 쓴 책인데요.

    http://stevesouders.com/examples/rules.php

    http://video.yahoo.com/video/play?vid=1040890

    :

    apache tuning tip..

    ITWeb/서버관리 2009. 1. 5. 13:37

    기냥 access_log 쪽 tuning 을 좀 할까 하다.. 어서 본거 몇자 적어 본다.. (나중에 또 까먹지 말도록..)
    http://httpd.apache.org/docs/2.0/mod/mod_log_config.html
    http://httpd.apache.org/docs/2.0/ko/mod/mod_setenvif.html

    AllowOverride 설정은 None 으로 하는걸 추천 합니다.
    왜 인지는 문서를 보세요. ㅋ
    .htaccess 파일을 매 request 마다 오픈 하게 되면 당연히 퍼포먼스가 안좋겠죠..
    그래서 None 으로 설정을 하게 됩니다.

    이와 더불어 Options FollowSymLinks 도 사용하세요.
    apache 가 symlink 인지 확인 하기 위해서 system call 을 하게 되는 부하를 줄일수 있다고 하내요.

    KeepAlive Off
    dynamic content 를 요구 하는 web server 설정에는 off 로 하시구요.
    static content 를 요구 하는 이미지 server 설정에는 on 으로 하시면 좋습니다.
    특성에 맞춰서 잘 사용하시면 당근 좋겠죠.. ;;

    Allow from ip range 표현은..
    Allow from 196.128 또는 196.128.* : 196.128 로 시작하는 ip 만
    Allow from 196.128.0.0 - 196.128.0.255 : 해당 범위 까지만
    Allow from 196.128.0.0/196.168.0.255

    Allow from 196.128.0.0 196.128.0.1 : space 로 구분 지어서 설정한 ip 만

    Allow from 196.128.0.0/24 == 196.128.0.0/255.255.255.0 : netmask 와 연동

    암튼.. reference url 은.. http://www.apache.org

    아래는 어서 봤는데 원본 링크가 생각이 안난다는..ㅡㅜ; I'm sorry.
    all
    All hosts are allowed access.

    A (partial) domain name
    All hosts whose names match or end in this string are allowed access.

    A full IP address
    The first one to three bytes of an IP address are allowed access, for subnet restriction.

    A network/netmask pair
    Network a.b.c.d and netmask w.x.y.z are allowed access, to give finer-grained subnet control. For instance, 10.1.0.0/255.255.0.0.

    A network CIDR specification
    The netmask consists of nnn high-order 1-bits. For instance, 10.1.0.0/16 is the same as 10.1.0.0/255.255.0.0.

    :