Jekyll build has me confused

I developed a site,

Method 1:

I use jekyll build I take _site and move all the files to /var/www/ I go to

  • The index page is there along with it’s styling and images
  • None of the links work
  • There are no posts

Method 2:

I cd into /var/www/ with my jekyll site folder, I do jekyll build I now have _site inside my jekyll project. I go to

  • 403 Forbidden (meaning I have no index to serve up)
  • exists in the root (/var/www/
  • index.html exists in the _site (/var/www/

What about this process is not correct? I expect jekyll build to give me a site that functions like my development site did. Am I expecting the wrong result? What is the actual process? The docs just say:

Typically you’ll use jekyll serve while developing locally and jekyll build when you need to generate the site for production.

Which isn’t super helpful

are you using something to serve the site? if you just browse the site without a web server of some sort it normally will not work quite right. Without a webserver the relative urls won’t work IIRC.

Jekyll build should do what you want - build the site as you see it when you do serve.

My guess is you are not using a web server - jekyll serve uses a webbrick web server and that is how it works.

Yes, I have an nginx server. I can ping 80 / 443 / 4000. I can place an index.html in /var/www/ and it will be live (as described in Method 1, I can build the site and place all of those files in /var/www/ and go to and see my index page) none of the links work. The index page is the only viewable page after jekyll build

Yes I am running an nginx site, I can ping ports 80 / 443 / 4000 and everything is fine. As described above I can (in method 1) build the site and place those files in the root /var/www/ and I go to mysite and see the index page but none of the links on that page work, there are no posts generated with the build, is now blog.html but the {{ ‘/blog’ | absolute_url }} is supposed to go to and I see my posts. is a 404. In development this link works fine (for example)

When I go to mysite after doing build there is in the root and _site/index.html is in the root and my server responds with 403.

maybe a security/permissions issue?

The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it.

When you say the posts are not generated you mean when you do jekyll build and go look in the _site folder they aren’t in there anywhere?

I understand this, I configured the web server. I understand how IT works, I need to understand the Jekyll BUILD process. My web server does not serve up .md files by design since I personally did not add those into the configuration file for what files get served up.

I expect when I “build” the site there is a index.html (index.html is enabled in my nginx configurations since I expect there to be an index file in EITHER /myjekyllsite or /myjekyllsite/_site after building [which there is]).

If I move all of the contents of /_site to my root directory (there IS an index.html in this folder) I CAN view this index.html, it is not a permissions issue, it is not a server issue. I can place a simple index.html file in the root and VIEW that index.html file.

If I leave the whole development folder in the root and build the site and go to my domain i get the 403 (AS EXPECTED) because I have not set up my configuration to serve up .md files. Jekyll should BUILD an html file that I will serve. Which it does.

Maybe you just aren’t understanding what is going on exactly.

You only deploy the _site folder - like your method 1.

When you say none of the posts are generated when you do jekyll build it is not clear to me what this means - are the files rendered to where they are supposed to be if you look for them in the _site folder?

If the posts get rendered when you do serve but not when you do build that would be really weird as the only real differences between build and serve are the built in webserver and I think some changes to the way the relative_url and absolute_urls are created? That wouldn’t change whether or not the posts were actually rendered though. I’m assuming you just can’t browse to them for one reason or another.

what about - with a trailing slash? trailing slash removal I think is something the webbrick server handles on its own but needs to be configured on a web server?

when you look in the _site folder, where is the /blog index file? normally it would be in /blog/index.html but it could also be blog.html I think.

1 Like

That is what is so odd to me… I may need to test this out more locally before attempting it on a server. I think the issue is in my VPS provider more than likely. Some security thing it is not building correctly for some reason? Let me contact them and see wth is going on here. I appreciate it.

It was my server. I got it figured out finally, thank you so much for your help :slight_smile:

1 Like