관리 메뉴

투덜이 개발자

[apache] 아파치 설정 보안 본문

OS/Linux

[apache] 아파치 설정 보안

엠투 2025. 4. 7. 11:34
반응형
<VirtualHost *:80>
	# ServerAdmin webmaster@localhost
	ServerName www.yourdomain.or.kr
	DocumentRoot /data/www/yourdomain.or.kr/www
	DirectoryIndex index.php
	ErrorLog "|/usr/bin/cronolog ${APACHE_LOG_DIR}/%Y%m%yourdomain.or.kr_error.log"
	CustomLog "|/usr/bin/cronolog ${APACHE_LOG_DIR}/%Y%m%d_yourdomain.or.kr_access.log" combined

	# mod_rewrite 활성화
	RewriteEngine On

	# QUERY_STRING에서 XSS 특수문자 차단
	RewriteCond %{QUERY_STRING} [<>\"']
	RewriteRule .* - [F,L]

	# REQUEST_URI(경로)에서 XSS 특수문자 차단
	RewriteCond %{REQUEST_URI} [<>\"']
	RewriteRule .* - [F,L]

	# .php 뒤에 슬래시가 붙으면 403 또는 404로 차단
	RewriteCond %{REQUEST_URI} \.php/
	RewriteRule .* - [F,L]

	# 사용자 정의 에러 페이지 설정
	ErrorDocument 403 /403.php
	ErrorDocument 404 /404.php
	ErrorDocument 500 /500.php
</VirtualHost>

 

# mod_rewrite 활성화
RewriteEngine On

# QUERY_STRING에서 XSS 특수문자 차단
RewriteCond %{QUERY_STRING} [<>\"']
RewriteRule .* - [F,L]

# REQUEST_URI(경로)에서 XSS 특수문자 차단
RewriteCond %{REQUEST_URI} [<>\"']
RewriteRule .* - [F,L]

# .php 뒤에 슬래시가 붙으면 403 또는 404로 차단
RewriteCond %{REQUEST_URI} \.php/
RewriteRule .* - [F,L]

 

 

 

반응형