1

I'm running a server with GitLab on it, and want to be able to use nginx for other services too (in my instance, Jenkins). I've modified the GL config to add additional vhosts as per this answer and it's all working fine.

However, I want to also set an SSL certificate with certbot, however when I run sudo certbot --nginx, I get the following:

nginx: [error] invalid PID number "" in "/run/nginx.pid"

I presume this is because GitLab's nginx instance isn't putting a pid into the run dir like a normal nginx instance would. So, my question is either:

Can GitLab be configured to create a PID here?

... or

Can certbot be configured to look for a PID elsewhere?

Matt Fletcher
  • 8,182
  • 8
  • 41
  • 60
  • (Ps, I know I can just do it manually and then edit the nginx myself, but I'd like to know if it's possible to do it automatically as it's a bit of a PITA) – Matt Fletcher Feb 20 '19 at 13:54

1 Answers1

0

I managed to find a pretty simple workaround for this...

cat /var/opt/gitlab/nginx/nginx.pid > /run/nginx.pid

You put this in a script or execute it before executin certbot --nginx command

It's not the best solution, but it seems that certbot doesn't have an option to specify pid path.

EDIT: Explanation

Gitlab omnibus nginx pid file is located in /var/opt/gitlab/nginx/nginx.pid, this way we just write the same PID to the location that certbot is looking by default (or perhaps misinterpreted config)

Milan Markovic
  • 1,250
  • 13
  • 18