Configure Jekyll to use different port?

I’m pretty new to setting up servers and Jekyll. I’m got a small server running, I can access Jekyll just fine by typing in the ip + port like . I’ve also got me own domain from way back that I can reconfigure to point the the ip. All that remains is the Port.

Just typing the works too, but this will just show the var/html/www/ list. I know you can start Jekyll with a different port, but how do I make it that when I go to the ip, my self-hosted Jekyll shows?

1 Like

you are talking about out on the real internet? not just locally?

DNS is what matches the domain name to the IP. It sounds like you are running your own webserver and running jekyll on that server?

I would ask why, there are way easier ways to do it. Like S3 or GitHub pages.

Generally I would say you would only run Jekyll locally - not on the server, then when you like it you do Jekyll Build, then you take the Site folder and stick it on a web server.

Where ever you purchased the domain from probably offers free dns services.

Yes, the real internet. I’ve got a virtual machine/virtual server I can access via ssh and sftp. I got it running and can access the Jekyll I startet from from the server at location A, from home via my browser at location B. Problem is I can only access it if I append the :4000 to the url, because that’s the port.

I start the server with jekyll serve --host=

But I don’t want that. So…how do I make jekyll appear at without the port :4000

Because I have control over what happens with my data that way. I don’t trust anybody but myself with my data, especially not in 2018. But that’s beside the point.

Nobody got any idea!!! I don’t believe it…

I googled jekyll server port number
and got this:

and this:

My understanding is WEBbrick (the simple Ruby server Jekyll uses) was never meant to be used in production. I know I’ve seen other threads from folks wanting to use it this way, and pretty sure the outcome was don’t.

But I could be wrong.


But then how does Github do it? They don’t have a :abcd in their URL, but I’m sure they’re using a different port somehow. Even doesn’t have it, and I’m pretty sure those are Jekyll pages running.

The point is not to have a different port like , the point is to have a url no port in it which goes to the Jekyll pages.

1 Like

To clarify, this is what I mean: , that’s the server I’m running. I cannot get the Jekyll pages when I call I have to append the :4000 . I.DO.NOT.WANT.THAT.

I think you’re confusing a “normal” webserver with the WEBbrick one Jekyll fires up when you build locally using the jekyll serve command.

GitHub Pages isn’t using Jekyll to serve your posts/pages. They use Jekyll to build it, then serves those files using a more traditional method.

Also if you use the jekyll build command instead of serve you will get files that don’t have the port.

Unless of course you are overriding something to include them. jekyll serve and jekyll build aren’t exactly the same thing. There’s some “magic” with serve where Jekyll does some things for you that usually trips people up… i.e. it overrides site.url with localhost:4000 regardless if you populate it with something else.

1 Like

your web browser assumes the port is 80 or 443 - if it is not then that is when you need to specify the port (at least I think that is correct). If you change the config to use port 80 and your firewall allows that, you probably could get it to work if you have a static IP address and can set that in your DNS server (probably from your domain supplier).

Like MM says though, this is really not a good idea, the built in server for jekyll is not a production server, it is just meant for local development. I certainly have never done it, so I could be totally wrong.

If you really want to host the site on your own server try using a real webserver app like IIS if you are on windows or apache if linux. Or any other one that suits you. Then use Jekyll build to build your site, and serve it from the _site folder.

It sounds like you are expecting jekyll to be an all in one webdev and hosting solution; it is not. Not even close to a hosting solution.


Oh wow…did I completely misunderstand Jekyll…:eyes:, that’s excatly what I was thinking rdyar.

I got it now. jekyll build, and upload the _site folder to any normal webserver and serve the content.

Wooops… now I get it:

1 Like

i happened to want doing this for dev in container… which also requires the server listening on

perhaps somewhere else we could simply use jekyll serve --port 80 (which by the way would be the straight answer to op’s question) but there’s no permission here in CA.

and using bundle exec jekyll build --watch while configuring rails to use the _site folder should work much better as already pointed by others… except there’s also no permission for this.

so, for now i’ll just keep on using port 4000, but set on the container’s commands config file instead of running it on ssh. unless someone else wants to help resolve this.

anyway, mostly just wanted to share the couple of “discoveries” from my end, hoping this can help other folks who stumble here with similar questions in mind (including my future self). :slight_smile:

You Can Now Use

jekyll serve --port 80
jekyll s --port 80

and You Can access it on localhost

or just rote ports on the host os (assuming unix) manually
iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 4000
iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 4000
as per