Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have installed nginx and made follow host:

server {
  listen          80;       # Listen on port 80 for IPv4 requests

  server_name     jenkins.mydomain.ru;
  root            /var/lib/jenkins;

  access_log      /var/log/nginx/jenkins_access.log;
  error_log       /var/log/nginx/jenkins_error.log;

  location / {
      auth_basic            "Restricted";
      auth_basic_user_file  /etc/nginx/passwd/htpasswd;

      proxy_pass         http://127.0.0.1:8080/;
      proxy_redirect     off;

      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_max_temp_file_size 0;

      client_max_body_size       10m;
      client_body_buffer_size    128k;

      proxy_connect_timeout      90;
      proxy_send_timeout         90;
      proxy_read_timeout         90;

      proxy_buffer_size          4k;
      proxy_buffers              4 32k;
      proxy_busy_buffers_size    64k;
      proxy_temp_file_write_size 64k;

      # Optional configuration to detect and redirect iPhones
      if ($http_user_agent ~* '(iPhone|iPod)') {
          rewrite ^/$ /view/iphone/ redirect;
      }
  }
}

After that I can access to Jenkinks in jenkins.mydomain.ru and it's require password. But I still can access to Jenkinks in http://mydomain.ru:8080/ without any password. How can I disallow access to Jenkinks in http://mydomain.ru:8080/?

share|improve this question

1 Answer 1

Jenkins seems to be listening on port 8080, so nginx has no control over it -- you need to go to jenkins' config file and tell it to listen on 127.0.0.1 (local connections only), where I would guess that it's currently set to 0.0.0.0 (open to all)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.