Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (28 sloc) 1.21 KB
layout title
Self hosted project pages

Today I learned how to self-host gh-pages-esque project pages in an easy way using an nginx alias.

I have my main domain: which lives in /var/www/

I wanted to be able to cd into that directory, clone any new repos, and if there is a gh-pages branch, serve it with the url as

Normally, this URL structure doesn't play nicely with jekyll sites, as jekyll compiles the site to the _site/ folder by default. The index.html file in /var/www/ is the yaml-filled jekyll-ready index file, not the compiled file with all of my posts listed out.

Essentially, I wanted to set the document root of to /var/www/

Here's how I accomplished this task with an nginx alias: {% highlight text %} server { listen 80; root /var/www/; server_name; index index.html;

location /project-name/ {
    alias /var/www/;

} {% endhighlight %}

In a later post, I'd like to explore the possibility of doing this automatically, perhaps with a try_files directive.

You can’t perform that action at this time.