Search code examples
node.jsnginxexpressghost-blog

Allowing access to sub folder when running Ghost


I'm hoping to create a folder of stand-alone pages to use as demos that are referenced in my Ghost blog. For instance, if I'm writing a tutorial on development, I'd like to link to a completed demo of the finished product.

So if my Ghost blog is at http://blog.mysite.com, I'd like to have access to any stand alone files in http://blog.mysite.com/demos

Any ideas?


Solution

  • To accomplish this you have to tell your webserver to point incoming traffic from /demos/ to another location than Ghost. You are not saying what webserver you are running your site on, so i'll give you two examples.

    Say your demo files is located in the following directory /var/www/demos

    Apache, mapping url to location
    The Alias directive allows documents to be stored in the local filesystem other than under the DocumentRoot.

    Alias  /demos/  /var/www/demos
    <Directory /var/www/demos>
        Options All
        AllowOverride All
        order allow,deny
        allow from all
    </Directory>
    

    Apache documentation

    NGINX, mapping url to location
    The alias defines a replacement for the specified location.

    location /demos/ {
        alias /var/www/demos/;
    }
    

    NGINX documentation