Hi Darcy, I've done this successfully with apache, but not with nginx.  To
do so, I had to add some extra stuff to the app itself, because configuring
the webserver is just half the battle, you also need to deal with Django.
So, hopefully this is still relevant to you.

First, make a directory called 'static' inside of your app
(hku_heritage/hku_heritage/static)

Next, add some more variables to settings.py.  The following are from an
app that is served from domain.com/app_name/ (hence the use of PACKAGE_NAME
in the formatted strings below).  I don't recall why I used os.path.join()
and .format() to achieve the basically the same thing here, but I do recall
trailing slashes important somehow.

# static files settings
STATIC_ROOT = os.path.join(PACKAGE_ROOT, 'static') # file system directory
path
STATIC_URL = '/{0}/static/'.format(PACKAGE_NAME) # url prefix that Django
creates for this file path

# uploaded files settings, may as well deal with this now...
MEDIA_ROOT = os.path.join(PACKAGE_ROOT, 'uploads') # file system directory
path
MEDIA_URL = '/{0}/uploads/'.format(PACKAGE_NAME) # url prefix that Django
creates for this file path

Finally, you'll need to run python manage.py collectstatic in order for
django to collect all the static files into your new static root directory.

Not sure if that will solve everything, but those steps should be necessary
no matter what.  Like I said, it's no problem with apache, so it can't be
much harder with nginx.

Adam

On Mon, Feb 22, 2016 at 7:48 PM, Darcy Christ <[email protected]> wrote:

> Hi,
>
> Has anyone successfully rooted Arches HIP under a subdirectory? I am using
> nginx and gunicorn to serve static files and to run on port 80. I've found
> a few tutorials, but I seem to be missing something.
>
> Here's my configuration:
>
> location /subdir/ {
>
>         # an HTTP header important enough to have its own Wikipedia entry:
>
>         #   http://en.wikipedia.org/wiki/X-Forwarded-For
>
>         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>
>
>         # enable this if and only if you use HTTPS, this helps Rack
>
>         # set the proper protocol for doing redirects:
>
>         # proxy_set_header X-Forwarded-Proto https;
>
>
>         # pass the Host: header from the client right along so redirects
>
>         # can be set properly within the Rack application
>
>         proxy_set_header Host $http_host;
>
>         proxy_set_header SCRIPT_NAME /subdir;
>
>
>         # we don't want nginx trying to do something clever with
>
>         # redirects, we set the Host: header above already.
>
>         proxy_redirect off;
>
>
>         # set "proxy_buffering off" *only* for Rainbows! when doing
>
>         # Comet/long-poll stuff.  It's also safe to set if you're
>
>         # using only serving fast clients with Unicorn + nginx.
>
>         # Otherwise you _want_ nginx to buffer responses to slow
>
>         # clients, really.
>
>         # proxy_buffering off;
>
>
>         # Try to serve static files from nginx, no point in making an
>
>         # *application* server like Unicorn/Rainbows! serve static files.
>
>         if (!-f $request_filename) {
>
>             proxy_pass http://arches_server;
>
>             break;
>
>         }
>
>     }
>
> --
> -- To post, send email to [email protected]. To unsubscribe,
> send email to [email protected]. For more
> information, visit https://groups.google.com/d/forum/archesproject?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Arches Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- To post, send email to [email protected]. To unsubscribe, send 
email to [email protected]. For more information, 
visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to