Linux
Apache 설정 (2.2.0 version)
마니씨
2010. 1. 11. 16:21
httpd.conf 에는 기본적인 내용만 들어 있고, conf/extra 디렉토리에 추가적인 내용들이 분류별로 나와 있다.
-rw-r--r-- 1 root root 2845 Dec 21 19:31 httpd-autoindex.conf
-rw-r--r-- 1 root root 1673 Dec 21 19:31 httpd-dav.conf
-rw-r--r-- 1 root root 2344 Dec 21 19:31 httpd-default.conf
-rw-r--r-- 1 root root 1103 Dec 21 19:31 httpd-info.conf
-rw-r--r-- 1 root root 5040 Dec 21 19:31 httpd-languages.conf
-rw-r--r-- 1 root root 810 Dec 21 19:31 httpd-manual.conf
-rw-r--r-- 1 root root 3782 Dec 21 19:31 httpd-mpm.conf
-rw-r--r-- 1 root root 2201 Dec 21 19:31 httpd-multilang-errordoc.conf
-rw-r--r-- 1 root root 10338 Dec 21 19:31 httpd-ssl.conf
-rw-r--r-- 1 root root 815 Dec 21 19:31 httpd-userdir.conf
-rw-r--r-- 1 root root 1453 Dec 21 19:31 httpd-vhosts.conf
아래와 같이 주석 처리된 것을 필요에 따라 풀면 된다.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf |
Configuration
ServerRoot |
"/usr/local/apache" |
ServerAdmin |
youremailaddr |
ServerName |
yourdomain:80
but 여러 도메인을 관리하는 서버면 의미없다.
Virtual Host 셋팅으로 처리한다. |
DocumentRoot |
"/usr/local/apache/htdocs"
but 여러 도메인을 관리하는 서버면 의미없다.
Virtual Host 셋팅으로 처리한다. |
기본 접근 설정 |
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
아래와 같이 변경
BrowserMatch "WebZIP" shit
BrowserMatch "Teleport" shit
BrowserMatch "GetRight" shit
BrowserMatch "^FlashGet" shit
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Deny from shit
# Order deny,allow
# Deny from all
</Directory> |
DirectoryIndex |
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule> |
CustomLog |
CustomLog logs/access_log common
# CustomLog logs/access_log combined
아래와 같이 변경
# CustomLog logs/access_log common
CustomLog logs/access_log combined |
ScriptAlias |
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/usr/local/apache-2.2.0/cgi-bin/"
</IfModule>
아래와 같이 변경
<IfModule alias_module>
# ScriptAlias /cgi-bin/ "/usr/local/apache-2.2.0/cgi-bin/"
</IfModule>
<Directory "/usr/local/apache-2.2.0/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
아래와 같이 변경
#<Directory "/usr/local/apache-2.2.0/cgi-bin">
# AllowOverride None
# Options None
# Order allow,deny
# Allow from all
#</Directory> |
PHP 설치 후 |
DSO Support 부분에 다음 추가
LoadModule php5_module modules/libphp5.so
다음과 같이 AddType 추가
<IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule> |
MPM |
#Include conf/extra/httpd-mpm.conf
주석 해제 활성화, 자세한 사항은 잘 모름 |
Multi-Language Error Code |
#Include conf/extra/httpd-multilang-errordoc.conf
주석 해제 활성화, 다국어 에러 코드 페이지 |
Language |
#Include conf/extra/httpd-languages.conf
주석 해제 활성화, 다국어 지원 |
User Home Dir |
# User home directories
#Include conf/extra/httpd-userdir.conf
아래에 다음을 추가
UserDir public_html
public_html 디렉토리 퍼미션을 711로 설정 |
Server Info |
#Include conf/extra/httpd-info.conf
주석 해제 활성화, 서버 상태 및 정보 제공
conf/extra/httpd-info.conf 에서
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from xxx.xxx.xxx.xxx -> 추가. IP는 내 컴퓨터 고정 IP
</Location>
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from xxx.xxx.xxx.xxx -> 추가. IP는 내 컴퓨터 고정 IP
</Location> |
Virtual Host |
#Include conf/extra/httpd-vhosts.conf
주석 해제 활성화, 가상 호스트 config 파일 참조
conf/extra/httpd-vhosts.conf
NameVirtualHost 61.109.245.230
<VirtualHost 61.109.245.230>
ServerAdmin youremailaddr
DocumentRoot yourhomedir
ServerName yourdomain
ServerAlias yourdomainalias
ErrorLog logs/yourdomain-error_log
CustomLog logs/yourdomain-access_log combined
</VirtualHost> |
출처 : http://lsk.pe.kr/315