Jekyll: Can I host my Jekyll site with same <IP address:80> but different <HOSTNAME>?

Created on 6 Feb 2017  ·  3Comments  ·  Source: jekyll/jekyll

I have created two jekyll site:
_config.yml of Site 1:
...
port: 80
host: site1.enx.rentals
...

_config.yml of Site 2:
...
port: 80
host: site2.enx.rentals
...

But when I start the second site, it show: "... Address already in use ... "

Can I host my Jekyll site with same IP address but different HOSTNAME ?

thanks!!

frozen-due-to-age support

Most helpful comment

you can serve on a different host using the --host and --port switches:

# Site 1
$ bundle exec jekyll serve
# => "http://localhost:4000"

# Site 2
$ bundle exec jekyll serve --host myhost --port 1234
# => "http://myhost:1234"

All 3 comments

Jekyll is a static site generator, not a webserver. You may generate the static files and serve with webserver like nginx, which provides such abilities.

you can serve on a different host using the --host and --port switches:

# Site 1
$ bundle exec jekyll serve
# => "http://localhost:4000"

# Site 2
$ bundle exec jekyll serve --host myhost --port 1234
# => "http://myhost:1234"

I believe we override the url in development mode, so I'd recommend doing:

$ JEKYLL_ENV=production bundle exec jekyll serve --host myhost --port 1234

You can also host at 127.0.0.1:4000 like normal and use a reverse proxy like nginx which captures the request at MYHOSTNAME and forwards it onto the Jekyll server.

Note that the server Jekyll comes with is not production-ready. It's meant for development testing only.

Was this page helpful?
0 / 5 - 0 ratings