Accessing local server with base URL

1,300 views
Skip to first unread message

Ed Saito

unread,
Jan 27, 2011, 4:39:56 PM1/27/11
to jeky...@googlegroups.com
I am using Jekyll 0.10.0 and my _config.yml file is empty.

When I run the command

jekyll --server

the index page at http://localhost:4000 is accessible.

Now I am trying to understand the option to serve a website from a given base URL.

When I run the command

jekyll --server --base-url '/test'

I get a 404 response when trying to access http://localhost:4000/test and http://localhost:4000 also returns a 404 response.

How is the base URL option supposed to work with regards to the local host?  Do I have to change something in my _config.yml file, or am I missing another command line option?

Thanks for any additional information.

Krzysztof Wojciechowski

unread,
Jan 28, 2011, 1:24:49 PM1/28/11
to jeky...@googlegroups.com
Check if the server starts using some network testing tool.
Cheers,
— Kwpolska (http://kwpolska.co.cc)

> --
> You received this message because you are subscribed to the Google Groups
> "jekyll.rb" group.
> To post to this group, send email to jeky...@googlegroups.com.
> To unsubscribe from this group, send email to
> jekyll-rb+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jekyll-rb?hl=en.
>

Ed Saito

unread,
Jan 28, 2011, 2:36:17 PM1/28/11
to jeky...@googlegroups.com
The server does start.


When I run the command

--jekyll --server --base-url '/test'

I get the output:

WARNING: Could not read configuration. Using defaults (and options).
        Invalid configuration - C:/Documents and Settings/saitoed/My Documents/Development/Test Project/TestProject/_config.yml
Building site: C:/Documents and Settings/saitoed/My Documents/Development/Test Project/TestProject-> C:/Documents and Settings/saitoed/My Documents/Development/Test Project/TestProject/_site
Successfully generated site: C:/Documents and Settings/saitoed/My Documents/Development/Test Project/TestProject-> C:/Documents and Settings/saitoed/My Documents/Development/Test Project/TestProject/_site
[2011-01-28 14:27:19] INFO  WEBrick 1.3.1
[2011-01-28 14:27:19] INFO  ruby 1.9.2 (2010-12-25) [i386-mingw32]
[2011-01-28 14:27:19] INFO  WEBrick::HTTPServer#start: pid=2752 port=4000

When I try to access http://localhost:4000/test I get the output

[2011-01-28 14:31:29] ERROR `/test' not found.
localhost - - [28/Jan/2011:14:31:29 Eastern Standard Time] "GET /test HTTP/1.1" 404 274
- -> /test

And when I try to access http://localhost:4000 I get the output

[2011-01-28 14:34:00] ERROR `/' not found.
localhost - - [28/Jan/2011:14:34:00 Eastern Standard Time] "GET / HTTP/1.1" 404 270
- -> /

Can you please point me an example of how --base-url is supposed to work?

Krzysztof Wojciechowski

unread,
Jan 28, 2011, 2:39:15 PM1/28/11
to jeky...@googlegroups.com
I think it isn't. The jekyll wiki
(<https://github.com/mojombo/jekyll/wiki/Configuration>) doesn't list
such option.
Cheers,
— Kwpolska (http://kwpolska.co.cc)

Ed Saito

unread,
Jan 28, 2011, 2:52:51 PM1/28/11
to jeky...@googlegroups.com
That's because the page you list is probably dated.  Check out the commit Adding baseurl option. Fixes #51

There is a line that changed, which uses the new base URL command line argument:
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination)
Please note that when I run jekyll without the base URL option the site is accessible.  However, when I run jekyll with the base URL option, the behaviour is clearly different, so something is happening.

Either there is a bug or I am not using the option correctly. Probably the latter.

Could anyone please let me know if you got it to work?

Richard

unread,
Jan 4, 2012, 8:16:55 PM1/4/12
to jeky...@googlegroups.com
baseurl sets the path where you are mounting the website. So set to / to access your website at localhost:8080/

Unfortunately one of the plugins I use requires baseurl be set to the full domain, which messes up the local server configuration.

Surajram Kumaravel

unread,
Jan 7, 2012, 2:14:11 AM1/7/12
to jeky...@googlegroups.com
Why dont you set jekyll to run on port 80 and add an entry to your
/etc/hosts pointing the fqdn to 127.0.0.1?

> --
> You received this message because you are subscribed to the Google Groups
> "jekyll.rb" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/jekyll-rb/-/jmJABQUBuzkJ.

Reply all
Reply to author
Forward
0 new messages