sudo aptitude -y install nginx | |
cd /etc/nginx/sites-available | |
sudo rm default | |
sudo cat > jenkins | |
upstream app_server { | |
server 127.0.0.1:8080 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
listen [::]:80 default ipv6only=on; | |
server_name ci.yourcompany.com; | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
if (!-f $request_filename) { | |
proxy_pass http://app_server; | |
break; | |
} | |
} | |
} | |
^D # Hit CTRL + D to finish writing the file | |
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/ | |
sudo service nginx restart |
This comment has been minimized.
This comment has been minimized.
I am using something similar, but one problem I have encountered - how do you also force 8080 to use ssl ? currently requests on 8080 just bypasses nginx and go straight to jenkins - i want nginx to prompt with basic auth
|
This comment has been minimized.
This comment has been minimized.
@house9: make jenkins listen to 127.0.0.1 / localhost only. |
This comment has been minimized.
This comment has been minimized.
I would humbly like to recommend using a trick like: |
This comment has been minimized.
This comment has been minimized.
@rdegges How do we do it for nginx-php5-fpm |
This comment has been minimized.
This comment has been minimized.
@mmzoo Thanks. |
This comment has been minimized.
This comment has been minimized.
Remove or update this uber obsolete information from internet, you are confusing people . . . what is described in the instructions above do not apply in a brand-new Nginx installation. [root@jenkins nginx]# ll |
This comment has been minimized.
When using SSL, you might want to use something like the below nginx config.
Note that the third point is pretty tricky. We use
proxy_redirect http:// https://;
that corresponds to Apaches'sProxyPassReverse