Jekyll behind a NGINX proxy

All right. I have found my “mistake”.

The documentation may be detailed, but it is anything but suitable for newcomers to find their way around. But it is beautifully colourful.

Therefore, for all those who want to use jekyll on Debian 10 Buster and all that behind a NGINX proxy, this installation works.

apt-get install automake make gcc g++ ruby-full build-essential ruby-dev sudo

gem install bundler jekyll

Further then without root rights

mkdir [ path ]
cd [ path ]

bundle init

bundle config set path 'vendor/bundle'

bundle add jekyll

bundle exec jekyll new --force --skip-bundle . # Don't forget the dot!
bundle install	# installs missing gems

Starting the system for testing

JEKYLL_ENV=production bundle exec jekyll serve

My (part) NGINX conf

   location / {
        proxy_pass http://172.16.16.223:4000;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
   }

In case someone wants to have the whole thing a bit easier and wants to use jekyll-admin:

Securing the folder with a password would then work like this:

part of NGINX.conf for your Website

     location ^~ /admin {
         auth_basic "Administration";
         auth_basic_user_file /srv/htpasswd;

         proxy_pass http://172.16.16.223:4000/admin;

         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header Host $http_host;
     }

Network diagram

<Internet> - <Router with NGINX proxy> - <Jekyll server on internal network>

Thank you. That takes care of the “problem”.

Many greetings and stay healthy.

1 Like