
Terminal - Commands tagged apache - 22 results
/usr/bin/tail -fn0 /path/to/apache_error.log | while read line; do /usr/local/bin/growlnotify --title "Apache Notice" --message "$line"; done &
This is sample output - yours may be different.
Simply add this to whatever apache startup script you have, or if you are on a MAC, create a new automator application. This will show a pretty growl notification whenever theres a new Apache error log entry. Useful for local development
CustomLog "|nc -u IP PORT "<134>%{%b %d %X}t %h %l %u %t \"%r\"%>s %b \"%{Referer}i\" \"%{User-agent}i\""
This is sample output - yours may be different.
Send apache log to syslog-ng server without change configuration of syslog.
Just add in httpd.conf or vhost conf.
openssl rsa -in /path/to/originalkeywithpass.key -out /path/to/newkeywithnopass.key
This is sample output - yours may be different.
Strip a password from a openssl key to use with apache httpd server
This is sample output - yours may be different.
This is sample output - yours may be different.
# httpd -M
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
Easiest way to check which modules are loaded in apache.
ps h --ppid $(cat /var/run/apache2.pid) | awk '{print"-p " $1}' | xargs sudo strace
This is sample output - yours may be different.
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.
sudo chown -R nobody:admin /Applications/XAMPP/xamppfiles/htdocs/
This is sample output - yours may be different.
awk -F\" '/^DocumentRoot/{print $2}' $(httpd -V | awk -F\" '/\.conf/{print $2}')
This is sample output - yours may be different.
httpd -V | grep -i SERVER_CONFIG_FILE | cut -f2 -d'"' | xargs grep -i '^DocumentRoot' | cut -f2 -d'"'
This is sample output - yours may be different.
Grabs the Apache config file (yielded from httpd) and returns the path specified as DocumentRoot.
top -p `pidof apache2 | awk '{gsub(/[ ]/,",");print}'`
This is sample output - yours may be different.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13130 www-data 20 0 31452 4536 1128 S 0 0.2 0:00.00 apache2
12763 www-data 20 0 31596 4800 1220 S 0 0.2 0:00.00 apache2
12762 www-data 20 0 31596 4800 1216 S 0 0.2 0:00.00 apache2
12527 www-data 20 0 31596 4652 1220 S 0 0.2 0:00.01 apache2
10760 www-data 20 0 31596 4940 1284 S 0 0.2 0:00.02 apache2
Show only specific process id's using Top
pidof httpd | sed 's/ / -p /g' | xargs strace -fp
This is sample output - yours may be different.
( apache2ctl -t && service apache2 restart || (l=$(apache2ctl -t 2>&1|head -n1|sed 's/.*line\s\([0-9]*\).*/\1/'); vim +$l $(locate apache2.conf | head -n1)))
This is sample output - yours may be different.
Checks the apache configuration syntax, if is OK then restart the service otherwise opens the configuration file with VIM on the line where the configuration fails.
goaccess -f /var/log/apache2/access.log -s -b
This is sample output - yours may be different.
Total Requests 175723 Total Unique Visitors 9909 Total Referrers 5198 Log 51.19 MB
Failed Requests 0 Total Unique Files 7852 Total Unique 404 789 BW 4.17 GB
Generation Time 1 sec Total Static Files 7039 /var/log/apache2/access.log
484 7.01% 15/Oct/2010 ||||||||||||||||||||||||||||
656 9.49% 14/Oct/2010 ||||||||||||||||||||||||||||||||||||||
827 11.97% 13/Oct/2010 ||||||||||||||||||||||||||||||||||||||||||||||||
713 10.32% 12/Oct/2010 ||||||||||||||||||||||||||||||||||||||||||
824 11.93% 11/Oct/2010 ||||||||||||||||||||||||||||||||||||||||||||||||
1000 14.47% 10/Oct/2010 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
...
GoAccess is an open source real-time Apache web log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly. http://goaccess.prosoftcorp.com/
awk '$1~/^DocumentRoot/{print $2}' /etc/apache2/sites-available/default
This is sample output - yours may be different.
grep -i '^DocumentRoot' /etc/httpd/conf/httpd.conf | cut -f2 -d'"'
This is sample output - yours may be different.
tail -n2000 /var/www/domains/*/*/logs/access_log | awk '{print $1}' | sort | uniq -c | sort -n | awk '{ if ($1 > 20)print $1,$2}'
This is sample output - yours may be different.
sudo awk '($9 ~ /404/)' /var/log/httpd/www.domain-access_log | awk '{print $2,$9,$7,$11}' | sort | uniq -c
This is sample output - yours may be different.
This command will return a full list of Error 404 pages in the given access log. The following variables have been given to awk
Hostname ($2), ERROR Code ($9), Missing Item ($7), Referrer ($11)
You can then send this into a file (>> /path/to/file), which you can open with OpenOffice as a CSV
zcat access_log.*.gz | awk '{print $7}' | sort | uniq -c | sort -n | tail -n 20
This is sample output - yours may be different.
sudo strace -pXXXX -e trace=file
This is sample output - yours may be different.
ab -n 9000 -c 900 localhost:8080/index.php
This is sample output - yours may be different.
Completed 900 requests
Completed 1800 requests
Completed 2700 requests
Completed 3600 requests
Completed 4500 requests
Completed 5400 requests
Completed 6300 requests
Completed 7200 requests
Completed 8100 requests
Finished 9000 requests
Server Software: Apache/2.0.55
Server Hostname: localhost
Server Port: 8080
Document Path: /index.php
Document Length: 37949 bytes
Concurrency Level: 10
Time taken for tests: 407.890625 seconds
Complete requests: 9000
Failed requests: 25
(Connect: 0, Length: 25, Exceptions: 0)
Write errors: 0
Total transferred: 342093375 bytes
HTML transferred: 340598850 bytes
Requests per second: 22.06 [#/sec] (mean)
Time per request: 453.212 [ms] (mean)
Time per request: 45.321 [ms] (mean, across all concurrent requests)
Transfer rate: 819.03 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.7 0 78
Processing: 140 452 217.8 359 2265
Waiting: 31 402 194.0 328 2218
Total: 140 452 218.0 359 2265
Percentage of the requests served within a certain time (ms)
50% 359
66% 390
75% 421
80% 515
90% 750
95% 968
98% 1156
99% 1281
100% 2265 (longest request)
-n 9000 : Number of requests to perform for the benchmarking session
-c 900 : Number of multiple requests to perform at a time
/usr/sbin/apache2ctl -S 2>&1 | perl -ne 'm@.*port\s+([0-9]+)\s+\w+\s+(\S+)\s+\((.+):.*@ && do { print "$2:$1\n\t$3\n"; $root = qx{grep DocumentRoot $3}; $root =~ s/^\s+//; print "\t$root\n" };'
This is sample output - yours may be different.
Lists virtualhosts currently enabled for apache2, showing the ServerName:port, conf file and DocumentRoot
apache2 -t -D DUMP_MODULES
This is sample output - yours may be different.
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
php5_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)
Syntax OK
This let you know which modules has loaded the Apache server, very useful to know if the mod_rewrite is ready to use.