# HOWTO: Jenkins + nginx, FreeBSD



## rodrigc@ (Nov 7, 2013)

The following HOWTO describes step-by-step how to set up Jenkins under FreeBSD.

*INSTALL NGINX WEB PROXY*


 install nginx for a web proxy

`# pkg install www/nginx`


 create a /usr/local/etc/nginx/nginx.conf which redirects all web requests from port 80 to port 8180 (where we will run jenkins


```
server {
                listen       80;

                # Redirect all port 80 requests to Jenkins on
                # port 8180
                return 301 http://$host:8180/jenkins/$request_uri;
            }
```

    add to /etc/rc.conf


```
nginx_enable="YES"
```



*INSTALL JENKINS*


 Install jenkins with:

`# pkg install devel/jenkins`

 Add the following to /etc/rc.conf:


```
jenkins_enable="YES"
       jenkins_home="/usr/local/jenkins"
       jenkins_user="jenkins"
       jenkins_args="--webroot=${jenkins_home}/war --httpListenAddress=0.0.0.0 --httpPort=8180 --ajp13ListenAddress=0.0.0.0 --ajp13Port=8009 --prefix=/jenkins"
```


*START JENKINS AND NGINX*


 Start Jenkins:
`# service start jenkins`

 Start nginx:
`# service start nginx`


*CONFIGURING JENKINS*


 If your hostname is *myhost1.example.net*, then open a web browser at *http://myhost1.example.net*.

 Configure Jenkins via the web interface.

 Jenkins will place its configuration files under /usr/local/jenkins, as specified in
*jenkins_home* variable in /etc.rc.conf.

*FURTHER REFERENCES*


 http://jenkins-ci.org


----------

