Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to check the age of the document in the webpage but it does not show! here is the result of a telnet to the server:

telnet av.hostoi.com 80
Connected to av.hostoi.com.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Tue, 23 Oct 2012 16:55:40 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Connection: close
Content-Type: text/html

Connection closed by foreign host. 

on another server the following 2 lines are also included which are not present above:

Last-Modified: Fri, 17 Jun 2011 11:17:45 GMT
ETag: "2ce392-b1-4a5e688eae840"

So I searched the internet and as far as I could figure out there should be a configuration in apache to set headers on and etag on in htaccess? but I couldn't find any place that shows that.

Here are the loaded modules in apache if it would help:

core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include mod_filter mod_log_config mod_env mod_expires mod_headers mod_setenvif mod_version prefork http_core mod_mime mod_status mod_autoindex mod_asis mod_info mod_vhost_alias mod_negotiation mod_dir mod_actions mod_alias mod_rewrite mod_so mod_php5 mod_ruid2

As far as I read mod_header must be enabled which seems to be the case?

edit: tried the proposed solution: put a .htaccess file in / folder even though there is a file named do not upload here. contents of .htaccess:

#Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase / 
Options -Indexes 
SSILastModified on

<IfModule mod_expires.c>
FileETag MTime Size ExpiresActive on

ExpiresDefault "access plus 10 days"

ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType application/x-shockwave-flash "access plus 1 week"

ExpiresByType text/css "access plus 1 week"

ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/x-icon "access plus 6 month" 
ExpiresByType image/ico "access plus 6 month"
</IfModule>

i put this file in public_html folder and in the sub folder nod_update3 where the file update.ver exists. then i execute the script that checks the age of the document like so:

./check_http -H av.hostoi.com -u /nod_update3/update.ver -M 2d
HTTP CRITICAL: HTTP/1.1 200 OK - Document modification date unknown - 26316 bytes in 0,159 second response time |time=0,158965s;;;0,000000 size=26316B;;;0

as you can see no modification date is shown even though on the ftp client it shows it was last modified 25.10.2012

i tried the check on another file in the same folder like so:

./check_http -H av.hostoi.com -u /nod_update3/em000_32_l0.nup -M 2d
HTTP CRITICAL: HTTP/1.1 200 OK - Last modified 13,5 days ago - 56472 bytes in 1,059 second response time |time=1,059014s;;;0,000000 size=56472B;;;0
srvmon plugins #

as you can see the date modification is known. so why the problem with ver file? the file can be checked in this url: http://av.hostoi.com/nod_update3//update.ver

share|improve this question

2 Answers 2

X-Powered-By: PHP/5.2.17

It looks like that page is generated by PHP, in which case Apache doesn't know the Last Modified tamestamp. It is the PHP script's responsibility to set the Last-Modified header in this case, which it apparently doesn't do.

If these are simply static files then you probably want to configure Apache to serve them directly, instead of serving them via a PHP script. If they aren't static files then you need to fix the PHP script to set the Last-Modified header appropriately.

share|improve this answer
    
@Majed Please edit your question when adding more information, especially when adding debug information which doesn't format well in comments. –  mgorven Oct 25 '12 at 16:43
    
so what is your suggestion to do? –  Majed Oct 30 '12 at 5:37
    
@Majed The URLs you've provided are still being served by a PHP script. I've added to my answer. –  mgorven Oct 30 '12 at 6:14
    
if you mean but static, that they do not change then this is not the case, those files are replaced frequently hence the necessity to check the date not to be older than 2 days. so if index.php needs to be set up what has to be there if you know as i don't know php or html code –  Majed Oct 31 '12 at 12:58

we finally moved to new hoster and everything works now, thanks for the help and merry christmas. here is the result of the check.

srvmon plugins # ./check_http -H baza32.info -u /nod_update3/update.ver -M 3d

HTTP OK: HTTP/1.1 200 OK - 26168 bytes in 0,219 second response time |time=0,218608s;;;0,000000 size=26168B;;;0

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.