Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder with images that I need to be lightweight hosted. So I decided to go for lighttpd.

So I read that I had to add the following option in the config file:

mimetype.use-xattr = "enable"

It didn't work, when loading an image it was sended with an application/octet-stream file type header, and the browser would download it.

I read that the --use-attr was a flag when compiling, so I thought that maybe it was compiled without it (the build was from the Ubuntu repo) (the documentation says that the flag is actually --use-atttr but I think is a typo error since it says that option is unrecognized when I run configure).

So I downloaded the source and compiled and installed it with that flag:

configure --with-attr
make install

And here are the lighttpd features and version:

/usr/local/sbin/lighttpd -V
lighttpd/1.4.30-devel-2805 - a light and fast webserver
Build-Date: Oct  6 2011 10:39:46

Event Handlers:

        + select (generic)
        + poll (Unix)
        - rt-signals (Linux 2.4+)
        + epoll (Linux 2.6)
        - /dev/poll (Solaris)
        - eventports (Solaris)
        - kqueue (FreeBSD)
        - libev (generic)

Network handler:

        + sendfile


        + IPv6 support
        + zlib support
        + bzip2 support
        + crypt support
        - SSL Support
        + PCRE support
        - mySQL support
        - LDAP support
        - memcached support
        - FAM support
        - LUA support
        - xml support
        - SQLite support
        - GDBM support
share|improve this question
Are the Content-Type attributes in place on your image files? – Shane Madden Oct 6 '11 at 14:49
Does your lighthttpd.conf have correct values for mimetype.assign ? like this (that is assuming the question being about viewing and NOT downloading images in lighthttpd) – user Oct 6 '11 at 14:51
@ShaneMadden file -b --mime-type returns the correct value, so I guess the attributes are fine. @user The files don't have extensions so mimetype.assign would be rather useless, that's why I want Lighttpd to read the mime type from the file. – Zequez Oct 6 '11 at 15:19
up vote 0 down vote accepted

Verify that the extended attribute is in place with attr -g Content-Type, not file. Are you on a filesystem that supports XFS extended attributes, and are they in place?

mimetype.use-xattr is looking for extended attributes, while file is identifying the file via magic numbers.

share|improve this answer
It throws an error saying attr_get: No such file or directory and then it says it could not read the attribute from the file. So I guess my filesystem doesn't support XFS? – Zequez Oct 6 '11 at 16:35
@Zequez Did you give it the file location? Try attr -l /path/to/file - if there's no attributes, it should give a blank response. If that's the case, try setting a Content-Type attribute and see if it'll go; attr -s Content-Type -V image/jpeg /path/to/file – Shane Madden Oct 6 '11 at 16:39
yes, I gave the file name. When I tried attr -s Content-Type -V image/jpeg /path/to/file it threw attr_set: Operation not supported – Zequez Oct 6 '11 at 16:59
@Zequez Seems that extended attributes are not supported, then. – Shane Madden Oct 6 '11 at 17:02
well, thanks ^^. It seems that I'm going to have to find another way :B – Zequez Oct 6 '11 at 17:19

Your Answer


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.