Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a html presentation which I would like to serve on a subdomain on my server. It just consists of some static html files and some assets (the Github is here).

I'm trying to write an nginx config file which will serve the presentation. What I have so far is the following:

server {
  server_name make-js-like-ruby.grinnick.com;

  root /home/dtuite/stuff/presentations/make_js_like_ruby/introduction;

  access_log off;
  error_log off;
}

The actual root file is in /introduction/index.html. Nginx seems to serve that file by default which is fine. The problem is that none of the assets seems to be available on the page. You can see the problem live here..

How do I make the assets are available but also make sure that the subdomain roots to the index file correctly?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Move Root Path

Your current directory structure (on your hard drive) is like following

/home/dtuite/stuff/presentations/make_js_like_ruby/
    code/
    core/
    extensions/
    images/
    introduction/
    themes/

However, your root path is set to

/home/dtuite/stuff/presentations/make_js_like_ruby/introduction

The web server will not access any file outside that path. Since themes, images, etc., are all outside the above path, their content will not be served.

Fix

I suggest moving the root path one level up

root /home/dtuite/stuff/presentations/make_js_like_ruby;

Then move the index.html into /home/dtuite/stuff/presentations/make_js_like_ruby. Of course links within index.html will have to be modified accordingly.

share|improve this answer

Your Answer

 
discard

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.