# Serving jekyll generated site

**URL:** <https://www.ruby-forum.com/t/serving-jekyll-generated-site/183782>\
**Category:** NGINX\
**Created:** [February 19, 2010, 11:41pm UTC](https://www.ruby-forum.com/t/serving-jekyll-generated-site/183782 "2010-02-19T23:41:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeG](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@MikeG](https://www.ruby-forum.com/u/MikeG)\
**Post date:** [February 19, 2010, 11:41pm UTC](https://www.ruby-forum.com/t/serving-jekyll-generated-site/183782/1 "2010-02-19T23:41:41Z")

</div>

Hi all,

i’m trying to serve my blog made with jekyll and nginx. The blog should  
be hosted at  
[http://www.mydomain.com/blog](http://www.mydomain.com/blog). The problem is that all css, images and  
the posts are  
available at /css , /images and /2010/01/18/blogpost.html so they refere  
to the  
[http://mydomain.com/](http://mydomain.com/) although physically they are located at blog/…

Here you can see how it is stored on my server:

/var/www/blog$ ls  
2008 css images index.html  
xxx@xxx: /var/www/blog$

This is my nginx setup:

```
    location / {
            alias /var/www/blog/;
    }

    location /blog {
            root /var/www;
            index index.html index.htm;
    }

```

So with this setup i can serve all pages but the problem is that if  
somebody access [http://www.mydomain.com](http://www.mydomain.com),  
they will see the blog. This is not my expected behavior.

Could you please help me to set things up?

Thanks, Mike

Posted at Nginx Forum:

> **[Serving jekyll generated site](https://forum.nginx.org/read.php?2,55381,55381#msg-55381)**
>
> Hi all, i'm trying to serve my blog made with jekyll and nginx. The blog should be hosted at http://www.mydomain.com/blog. The problem is that all css, images and the posts are available at /css , /images and /2010/01/18/blogpost.html so they refere...

---

<div class="post-metadata">

**Author:** ![MikeG](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@MikeG](https://www.ruby-forum.com/u/MikeG)\
**Post date:** [February 26, 2010, 3:02pm UTC](https://www.ruby-forum.com/t/serving-jekyll-generated-site/183782/2 "2010-02-26T15:02:30Z")

</div>

> This is my nginx setup:
> 
> ```
> location / {
> alias /var/www/blog/;
> }
> 
> location /blog {
> root /var/www;
> index index.html index.htm;
> }
> 
> ```

Your config file is incorrect.

I would do something like:

server {  
listen 80;

location / {  
root /var/www/blog;  
index index.html index.htm;  
}  
}

---

<div class="post-metadata">

**Author:** ![MikeG](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@MikeG](https://www.ruby-forum.com/u/MikeG)\
**Post date:** [February 26, 2010, 3:05pm UTC](https://www.ruby-forum.com/t/serving-jekyll-generated-site/183782/3 "2010-02-26T15:05:19Z")

</div>

My bad:

server {  
listen 80;  
root /whatever/path;

location /blog {  
root /var/www/blog;  
index index.html index.htm;  
}  
}
