0

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?

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
duckyfuzz
  • 149
  • 1
  • 7

1 Answers1

4

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.

John Siu
  • 3,667
  • 2
  • 17
  • 23