2

I am given a try to lighttpd. I configured a server with the instructions I found here.

Below my configuration file:

server.document-root = "<my_site_directory>" 

server.port = 4000

server.username = "www" 
server.groupname = "www"

mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"
)

static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )

However, the images do not appear on the browser. The same seems to happen with css and js files. Since my images are in svg format, I tried adding to the mime types: ".svg" => "image/svg" but it did not help.

If I debug it using Chrome developer tools, I can see that for each image, css and js file I have this error:

"Failed to load resource: net::ERR_CONNECTION_REFUSED "

Just in case, I tried changing the server.username property to my user name (in case it is a problem of permits) but it did not help.

Sergio
  • 171
  • 1
  • 8
  • What kind of response code or error page are you getting when you try to directly access one of those files in your browser? – Shane Madden Mar 05 '14 at 21:52
  • If I directly write the url of the svg image, it is downloaded – Sergio Mar 05 '14 at 21:53
  • Are the wrong mime types being sent or something, then? Can you use debugging tools in your browser (F12 in chrome) to determine why it's not happy with those resources? – Shane Madden Mar 05 '14 at 21:57
  • I do not see anything strange with the developer tools. But maybe I am not looking in the right places. – Sergio Mar 05 '14 at 22:02
  • Network tab, the lines for the individual resources that are having problems? – Shane Madden Mar 05 '14 at 22:05
  • Found it. For each image, js and css file I have this error: "Failed to load resource: net::ERR_CONNECTION_REFUSED " – Sergio Mar 05 '14 at 22:07
  • Are those pointed to a different hostname or connection port in the URLs for the resources? – Shane Madden Mar 05 '14 at 22:29

2 Answers2

3

Finally fixed, the problem was indeed wrong MIME types. I added:

".js" => "text/javascript",
".css" => "text/css",

and replaced the wrong ".svg" => "image/svg" by ".svg" => "image/svg+xml"

Sergio
  • 171
  • 1
  • 8
1

FYI - according to RFC 4329 the proper MIME type for .js files should be "application/javascript".