Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed nginx and made follow host:

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

  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_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 and it's require password. But I still can access to Jenkinks in without any password. How can I disallow access to Jenkinks in

share|improve this question

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 (local connections only), where I would guess that it's currently set to (open to all)

share|improve this answer

Your Answer


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.