LoginSignup
4
4

More than 5 years have passed since last update.

nginxでjenkinsのサブドメイン設定が上手くできない

Last updated at Posted at 2015-03-29

jenkinsを導入したので、サブドメインでアクセスできるように設定したかったけど、nginxの設定方法がいまいちわからなかったので、調べてみた。

How To Configure Nginx with SSL as a Reverse Proxy for Jenkins | DigitalOcean

ここを参考に/etc/nginx/cond.d/...をこんな感じに。

server {
    listen 80;
    server_name jenkins.hostname;
    location / {
        proxy_pass http://localhost:8080;
        proxy_redirect http://localhost:8080 https://jenkins.hostname;
    }
}

と思ったらちゃんと公式に設定方法があったのでこちらを使うことにした。

Jenkins behind an NGinX reverse proxy - Jenkins - Jenkins Wiki

server {
  listen 80;
  server_name jenkins.domain.tld;

  location / {
    proxy_pass              http://localhost:8080;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout   150;
    proxy_send_timeout      100;
    proxy_read_timeout      100;
    proxy_buffers           4 32k;
    client_max_body_size    8m;
    client_body_buffer_size 128k;

  }
}

うーむ。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4