a2enmod mod_status rewrite
vi /etc/apache2/mods-enabled/status.conf
<Location /server-status>
SetHandler server-status
Require local
Require ip 120.115.3.0/24
</Location>
systemctl restart apache2
http://網址/server-status?refresh=10
vi /etc/apache2/envvars
把其中limit的註解取消
APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
重啟網站
vi /etc/apache2/conf-enabled/security.conf
找出底下兩個設定項目,並修改其值
ServerTokens Prod
ServerSignature Off
重啟網站
service apache2 restart
ps aux | grep apache2 | awk '{ total += $6; } END { print total/1024"MB" }'
ps aux | grep apache2 | awk '{ total += $3; } END { print total"%" }'
ps faux|grep apache2|wc -l
ps -eLf|grep apache2|wc -l
ps -eLf|grep $程序編號 |wc -l
netstat -nat|awk '{print awk $NF}'|sort|uniq -c|sort -n
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
top -b -o +%MEM | head -n 17
top -b -o +%CPU | head -n 17
netstat -ae|grep www-data
netstat -nat|grep ":80"|awk '{print $5}' |awk -F: '{print $1}' | sort| uniq -c|sort -n
apache2 -V
若出現類似以下訊息:
[Mon Oct 16 22:34:47.936456 2017] [core:warn] [pid 9405] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
則執行以下指令,重新匯入Apache環境變數:
. /etc/apache2/envvars
接者再執行原本指令,應該就會看到正確信息,如:
Server version: Apache/2.4.25 (Debian)
Server built: 2017-09-19T18:58:57
Server's Module Magic Number: 20120211:68
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"
從第7行可以得知,目前跑的是 prefork 模式。因此,開啟對應設定檔編輯之:
vi /etc/apache2/mods-available/mpm_prefork.conf