목록Apache (36)
변군이글루

아파치 모니터링 명령어 #아파치 메모리 사용량 $ ps -ylC httpd | awk '{x += $8;y += 1} END {print "Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' Memory Usage (MB): 1618.67 Average Proccess Size (MB): 323.734 # 아파치 프로세스 개수 $ ps -ef | grep httpd | wc -l 6 #아파치 동시접속자 개수 $ netstat -an | egrep :80 | egrep ESTABLISHED | wc -l 7 #아파치 커넥션 개수 $ netstat -n | grep -F :80 | egrep '(ESTAB|SYN)'..

Apache 로그 logrotate(로테이드) 설정 apache logrotate 파일 편집 vim /etc/logrotate.d/apache $ cat /etc/logrotate.d/apache /logs/access/*-access-*.log /logs/error/*-error-*.log { daily rotate 7 notifempty missingok compress delaycompress sharedscripts postrotate /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true endscript } logrotate 실행 /sbin/logrotate -f /etc/logrotate.d/..

아파치에 IP로 접속 시 차단하는 방법 httpd-vhosts.conf 편집 - 차단하고자 하는 아이피(111.111.111.111)로 가상호스트 생성 $ vim /etc/httpd/conf.d/httpd-vhosts.conf ... LogFormat "%h %l %u %t %v:%p \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %Ts %Dμs" vcombined ... ServerName 111.111.111.111 Redirect / https://www.sangchul.kr/40x.html #RewriteEngine On #RewriteRule (.*) http://www.sangchul.kr/$1 [R=301,L] CustomLog "|/usr/sbin/..

Apache 디폴트 페이지 편집 환경 $ dnf install -y httpd $ httpd -v Server version: Apache/2.4.37 (centos) Server built: Sep 15 2020 15:41:16 welcome(welcome.conf) 페이지 편집 $ vim /etc/httpd/conf.d/welcome.conf Options -Indexes #ErrorDocument 403 /noindex/index.html ErrorDocument 403 http://www.sangchul.kr/40x.html Alias /noindex /usr/share/httpd/noindex Options MultiViews DirectoryIndex index.html AddLanguage ..