Apache2 content types

Discussion in 'Server Operation' started by charles, Sep 5, 2007.

  1. charles

    charles Banned

    I have an Apache2 webserver running and tried to find some information on content handlers and types but can't understand how it works.

    This is what I defined in my config file:

    Code:
       <Directory /home/mydir/public_html/ruby>
          Options ExecCGI FollowSymLinks
          AddHandler cgi-script .cgi
          AddType application/javascript .js
          AllowOverride all
          Order allow,deny
          Allow from all
          <IfModule mod_expires.c>
             ExpiresActive on
             ExpiresByType application/javascript "access plus 1 month"
             ExpiresDefault "access plus 24 hours"
          </IfModule>
       </Directory>
    
    But when I look at the request headers of a random JavaScript on my page it says

    Code:
    Content-Type	application/x-javascript
    Why is that? Should it be application/x-javascript or just application/x-javascript? And why doesn't my ExpiresByType work? It uses the default expiration time of 24 hours and not the JavaScipt one...

    Any idea? Tried to search for some good explanation but couldn't find one. Thanks anyway!
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Any errors in Apache's error log?
     
  3. charles

    charles Banned

    I do get a warning when I reload Apache2, could this be the probleM?

    Code:
    Forcing reload of web server: Apache2[Mon Sep 10 12:16:53 2007] [warn] NameVirtualHost xxx.xxx.xxx.xxx:0 has no VirtualHosts
    [Mon Sep 10 12:16:53 2007] [warn] NameVirtualHost xxx.xxx.xxx.13:0 has no Virtual Hosts
    [Mon Sep 10 12:16:53 2007] [warn] NameVirtualHost xxx.xxx.xxx.12:0 has no Virtual Hosts
    
     
  4. falko

    falko Super Moderator Howtoforge Staff

    These are just warnings that you can ignore.
     

Share This Page