WebFaction
Community site: login faq
0
1

Hi all, I have been tinkering around with my nginx conf file to try to get it to serve my static files but it appears from my error.log in nginx that I have set up the path wrongly somehow. Here is the line:

open() "/home/rawfish/webapps/nginx//html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: nginx.rawfish.webfactional.com, request: "GET /favicon.ico HTTP/1.0", host: "nginx.rawfish.webfactional.com"

I would like to serve my static files from /home/rawfish/webapps/static/ but I can't seem to point it there. Here is some other information that might help!

If you need any other information please tell me :)

server { listen 40181; server_name nginx.rawfish.webfactional.com;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location /static/ {
        # root   html;
        # index  index.html index.htm;
        alias /home/rawfish/webapps/static/;
    }

And here is my settings.py relevant section:

STATIC_ROOT = "/home/rawfish/webapps/static/"
STATIC_URL = "http://nginx.webfactional.com/"
STATICFILES_DIRS = [
#     os.path.join(PROJECT_ROOT, "static"),
#    '/home/rawfish/webapps/static/',
]

The main site is working but without any css and images while the subdomain nginx.rawfish.webfactional.com is able to output the "Welcome to Nginx!" message. Thanks for reading!

asked 20 Feb '12, 10:02

rawfish
324
accept rate: 0%

edited 20 Feb '12, 10:02


Hi,

The "STATIC_URL" in your configuration is wrong - it should be http://nginx.rawfish.webfactional.com/ instead.

Also, the best way to do this would be to serve static files directly through the FrontEnd Nginx server, instead of setting up your own Nginx server. to do that, simply create a static-only web app, point your STATIC_ROOT to it, and mount this app on the subdomain or subpath where you want to serve static files.

If you continue experiencing problems setting this up, please open a ticket.

permanent link

answered 20 Feb '12, 10:15

todork
1.2k5
accept rate: 34%

1

Thanks for the reply todork. Indeed that was a typo on my part but it still did not resolve the problem. However, I have taken your advice and gone back to using what I was previously using instead of tinkering around. :)

I would uprate your post but I don't have enough rep. Cheers!

(20 Feb '12, 10:46) rawfish

Hi again, Another possible problem I can see is that you've set it up to be served under /static/, so your URLs would be something like: http://nginx.rawfish.webfactional.com/static/something.html. In any case, using the frontend Nginx server to serve your static files is better.

(20 Feb '12, 10:54) todork
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×225
×186
×125

question asked: 20 Feb '12, 10:02

question was seen: 6,554 times

last updated: 20 Feb '12, 10:54

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM