2013/06/12 수요일
http v1.0 vs v1.1
1.0 : 웹브라우저가 문서요청 메시지를 서버에게 보낸다. 그 때 보내는 메시지는 GET 문서이름 http/1.0
서버는 클라이언트에 다시 제공해줌.
서버와 클라이언트간 FIN 메시지 보내주면서 3way handshake 로 FIN도 보내서 끗.
문서 요청하면 응답하고 바로 끊어집니다. 하이퍼링크 땜에 글케만듬. 한번 연결하고 바로 끊어지게 만듦.
1.1 : 한번 연결에 여러번..데이터 전달 가능.
그러나 url이 바뀌거나 dir가 바뀌면 연결세션이 끊어짐.
# elinks http://www.google.com 하면 cmd창에 요상하게 좌르륵 뜬데잉.
root 14442 1 0 13:11 ? 00:00:00 /usr/sbin/httpd // 80번 포트는 루트밖에 못 연다.
apache 14444 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd // 나머지 애들은 다 위에 애가 fork시킨 자식프로세스
apache 14445 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14446 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14447 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14448 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14449 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14450 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14451 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
apache 14452 14442 0 13:11 ? 00:00:00 /usr/sbin/httpd
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/etc/httpd" will be interpreted by the
# server as "/etc/httpd/logs/foo.log".
/부터 절대경로 쭉 적으면 서버의 실제경로이고
앞에 / 안 쓰고 걍 logs/foo.log 하면 httpd의 루트인 /etc/httpd 아래인것이당
# Don't give away too much information about all the subcomponents
# we are running. Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens OS // 서버의 정보를 어디까지 보여주겠다? OS까지
// 저렇게 해놓으면 이렇게 보인다
[root@station1 conf]# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0
HTTP/1.1 200 OK
Date: Tue, 11 Jun 2013 04:10:45 GMT
Server: Apache/2.2.15 (Red Hat)
Last-Modified: Mon, 03 Jun 2013 08:25:00 GMT
ETag: "27ef-acec-4de3bb359938a"
Accept-Ranges: bytes
Content-Length: 44268
Connection: close
Content-Type: text/html; charset=UTF-8
Connection closed by foreign host.
------------------------------------------------------------
#
# PidFile: The file in which the server should record its process
# identification number when it starts. Note the PIDFILE variable in
# /etc/sysconfig/httpd must be set appropriately if this location is
# changed.
#
PidFile run/httpd.pid // 이게 포크시킨다? 인건가
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 60 // 60초 지나면 연결 끊겠다
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off // 1.1 기능 다 쓰고 싶으면 on
// 아래 두개는 on일때만 적용
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100 // 한 번 연결에 100번까지만 요청 주고받겠다.
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15 // 이때는 15초로 timeout 하겠다.
[root@station1 ~]# httpd -l // httpd 가 어떤 모듈로 지금 실행되고 있는지
Compiled in modules:
core.c
prefork.c // 우리 모듈은 이거임
http_core.c
mod_so.c
[root@station1 ~]#
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM // 프로세스 베이스로 구동됨.
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c> // 만약 모듈이 prefork.c 가 올라가 있으면 이걸 적용시킬래요.
StartServers 8 // 프로세스 8개로 시작해. 우리 시스템에 얼마나 들어오는지 로그분석 하고 나서 숫자조절 여기서 해.
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
// 이런 식으로 모듈들을 로드해서 써... 필요없는거 뺴고
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set on", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off // 서버이름까지만 넣었을 때 도메인 이름 자동으로 넣어줄 것인가
<Directory "/var/www/html/subdirectory"> // 해서 특정 디렉토리에 대해서 각각 설정을 따로 할 수 있는데 여기서 뭐 따로 권한설정 등을 할 수 있다.
Options Indexes FollowSymLinks
AllowOverride None // 아래에 나옴. AccessFile 어쩌구..
Order allow,deny // 여기 순서에 따라 실행시켜라. top-down 방식이 아니라 여기서 allow 먼저 보고 deny 봐라 이런의미.
Allow from all
Deny from 10.100.0.20 // 해당 서버에선 못 보게할끄당 머이런.:$
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var // 기본 파일이 없을 때 시도하는 파일들. index.html -> index.html.var 파일 시도.
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess // 유저 인증 정보를 담고 있는 파일이름. AllowOverride 를 쓰게 되면 (none이 아니게 되면) 쓰게 되는 파일이름.
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
// htaccess 파일은 사용자인증파일이므로 중요하므로 가려놓는다.
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig /etc/mime.types // 파일 확장자별로 어떤 종류인지 타입 정의해놓은 파일.
// 확장자 없는 파일의 경우... 아래 mime_magic.c
#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain // 모르는 애들은 디폴트로 플레인 텍스트로...
// 막 어떨때 파일 눌렀더니 팡리이 다운이 안되고 열리면서 이상한 글자들 나오는거.. 그런게 이 경우임. 파일 종류 모를때.
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
<IfModule mod_mime_magic.c>
# MIMEMagicFile /usr/share/magic.mime
MIMEMagicFile conf/magic // 확장자 없으면 매직이라는 모듈 통해서 파일 헤더를 통해서 확인..해서 문서형태 책정
</IfModule>
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
[root@station1 subdir]# cd /var/log/httpd
[root@station1 httpd]# ls
access_log error_log ssl_access_log ssl_error_log ssl_request_log
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn // 로그레벨 warn 이상은 다 로깅하겟답.
'UNIX > Redhat' 카테고리의 다른 글
vsftpd 사용...... (0) | 2013.06.12 |
---|---|
xinetd / standalone (0) | 2013.06.12 |
repository ftp주소로 추가 + 영문버전 (0) | 2013.04.15 |
리눅스 원격 레포지토리 설정 (ftp 사용) (0) | 2013.04.15 |
명령어 경로 알기 (0) | 2012.12.05 |