본문 바로가기

기타/디지털

Apache 설정 (httpd.conf)

1. 특정 디렉토리 인증 처리

1) below AccessFileName .htaccess in httpd.conf

<Directory /dir>
        AuthName "Displayed Syntax"
        AuthType basic
        AuthUserFile AuthenticationFile
        require valid-user
</Directory>

2) make file for authentication

/usr/local/apache/bin/htpasswd
htpasswd -c fileName userName

2. 에러 페이지 변경

ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var -> change dir/file & disable notes

3. 특정 프로그램의 허용 막기

1) in httpd.conf

<Directory "/usr/local/httpd-{version}/htdocs">
     Order allow,deny
     Allow from all
     Deny from shit <- add
</Directory>

2) add BrowserMatch like below in tail of httpd.conf

BrowserMatch "WebZIP" shit
BrowserMatch "Teleport" shit
BrowserMatch "GetRight" shit
BrowserMatch "^FlashGet" shit

4. 가상 도메인 설정

Section 3: Virtual Hosts in httpd.conf

NameVirtualHost 000.000.000.000
<VirtualHost 000.000.000.000>
   ServerAdmin
youremail
   DocumentRoot /htdocs/dir1
   ServerName yourdomain
   ServerAlias yourdomain_without_hostname
   ErrorLog logs/yourdomain-error_log
   CustomLog logs/yourdomain-access_log combined
</VirtualHost>