Coder12432f
Coder12432f

Reputation: 27

Setting up Jenkins DNS

I've been trying to set up Jenkins on my VPS. I did everything and got it to work on the ip:8080. What I am really wanting to do is get it working on ci.domain.com, but I have been having trouble.

I use Pterodactyl on the same machine, which runs on Nginx.

When I point the domain to the ip I get redirected to Pterodactyl which is on hub.domain.com.

I tried setting up Jenkins with apache and leaving Pterodactyl on Nginx but didn't work.

Is there a way to make make it work?

Cheers.

Upvotes: 1

Views: 5882

Answers (1)

Matt
Matt

Reputation: 426

I had the same issue, seems like the nginx congif on the website doesn't work well.

Try this one:

upstream jenkins {
  server 127.0.0.1:8080 fail_timeout=0;
}

server {
  listen 80;
  server_name ci.domain.com;
  return 301 https://$host$request_uri;
}

server {
  listen 443 ssl;
  server_name ci.domain.com;

  #if you want sll
  #ssl_certificate put_path_here;
  #ssl_certificate_key put_path_here;

  location / {
    proxy_set_header        Host $host:$server_port;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_redirect http:// https://;
    proxy_pass              http://jenkins;
    # Required for new HTTP-based CLI
    proxy_http_version 1.1;
    proxy_request_buffering off;
    proxy_buffering off; # Required for HTTP-based CLI to work over SSL
    # workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651
    add_header 'X-SSH-Endpoint' 'jenkins.domain.tld:50022' always;
  }
}

Upvotes: 1

Related Questions