0

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
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

Features:

        + 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
3
  • Are the Content-Type attributes in place on your image files? Oct 6, 2011 at 14:49
  • Does your lighthttpd.conf have correct values for mimetype.assign ? like this cyberciti.biz/tips/wp-content/uploads/2006/07/lighttpd.conf.txt (that is assuming the question being about viewing and NOT downloading images in lighthttpd)
    – user
    Oct 6, 2011 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, 2011 at 15:19

1 Answer 1

1

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.

5
  • 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, 2011 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 Oct 6, 2011 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, 2011 at 16:59
  • @Zequez Seems that extended attributes are not supported, then. Oct 6, 2011 at 17:02
  • well, thanks ^^. It seems that I'm going to have to find another way :B
    – Zequez
    Oct 6, 2011 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .