Many times you might want to fine tune the default permissions of the files created on a linux system. This is very simple and usually if you are using bash all you have to do is to define somewhere in the bash startup files (/etc/profile is a good place for this) a new value for umask like this:
umask 002
(this will allow by default group write permissions on the newly created files)
Normally on modern linux distributions this is by default set to 022 and you can easily find out what it is on your system by running the umask command:
umask
Contrary to what you might think, this is not enough to have this working for all applications and daemons on the system. This works fine for any files created from a shell session, but the files created by other processes, like the web server for example, will still use the default, unless otherwise configured. In order to have apache use a different umask we can define this inside /etc/apache2/envvars (debian, and ubuntu systems) or /etc/sysconfig/httpd (rhel,centos systems) like this:
umask 002
and restart apache to enable it.
Other daemons will have different locations where you can define this to overwrite the default setting for umask (check their documentation if you are unsure).
Tags: apache, apache-tips-and-tricks, tips
Whatever web log analyzer you would use, at one time or the other you will end up with one problem: how to deal with weblogs rotation, to not have a gap in your statistics? This has various solutions starting with running the weblog analyzer at the prerotate step of logrotate, or maybe using some manual script.
This post will show how you can rotate the apache logs using awstats right after it has processed the logs. This can be beneficial for situations where you have quite big logs and using this method will keep them small all the time, and also where restarting apache just for logrotating is not such a good idea. Obviously for this to make sense, you need to be already using awstats for your log processing
.
Read the rest of this entry »
Tags: apache, awstats, logrotate
ApacheBench is one of the most common programs used to benchmark web servers.
By default apachebench will run using HTTP/1.0 requests and without compression enabled even if the tested server supports that.
For example:
ab -n 1 -v 4 "http://www.ducea.com/"
This is ApacheBench, Version 2.0.41-dev < $Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.ducea.com (be patient)...
INFO: POST header ==
---
GET / HTTP/1.0
User-Agent: ApacheBench/2.0.41-dev
Host: www.ducea.com
Accept: */*
---
LOG: header received:
HTTP/1.1 200 OK
Date: Fri, 27 Oct 2006 21:55:53 GMT
Server: Apache
Status: 200 OK
Connection: close
Content-Type: text/html; charset=UTF-8
Read the rest of this entry »
Tags: ab, apache, apache2, apachebench, benchmarks, mod_deflate, mod_gzip
Here you can find various tips & tricks for configuring and administrating Apache that I found to be useful. Once I will add a new tip, I’ll link it here so you can use this page as a main placeholder for all the tips I will post in the future. Each tip will consist in a very short description, what is it used for, where can you apply it (globally, per directory or per virtual hosts, if it can be activated without administrative privileges in .htaccess) and of course a how to implement it. I will try to keep each tip as short as possible and on a single topic so you can go directly to what you are looking for. Read the rest of this entry »
Tags: apache, apache-tips-and-tricks, apache2, htaccess, tips
While working on a project on mod_deflate, I have stumbled across this great link that allows you to test remotely any server if it has enabled compression (mod_gzip/mod_deflate) and also see some statistics on the bandwidth saved on the particular URL tested (this is achieved by making one request without gzip enabled and another one with gzip enabled).
I found it very handy while testing various things…
http://www.whatsmyip.org/http_compression/
http://www.ducea.com is gzipped
Original Size: 43 K
Gzipped Size: 10 K
Data Savings: 76.74%
Tags: apache, bandwidth, links, web_server