ess-acppo / ag-bie

This repository has the code to the agriculture's implementation of ALA BIE
1 stars 4 forks source link

add virtual host entry for (jetty) jenkins to ag-bie nginx #12

Closed mbohun closed 4 years ago

mbohun commented 6 years ago

NOTE: ag-bie ansible simple-jenkins role installs jetty+jenkins on 127.0.0.1:9192 the setup bellow will expose jenkins at:

  1. add location (virtual host) entry for jenkins to the nginx's /etc/nginx/sites-available/ag-bie.oztaxa.com.conf

    location ^~ /jenkins/ {
        # proxy_set_header Host $host;
        proxy_set_header Host ag-bie.oztaxa.com;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_read_timeout 10m;
    
        # additions
        proxy_redirect http:// https://;
        sendfile off;
    
        # Required for new HTTP-based CLI
        proxy_http_version 1.1;
        proxy_request_buffering off;
        proxy_buffering off; # Required for HTTP-based CLI to work over SSL
    
        proxy_pass http://127.0.0.1:9192/jenkins/;
    }
    
  2. in /etc/defaults/jenkins add/append --prefix=$NAME to JENKINS_ARGS
    JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --prefix=$PREFIX"
  3. login to jenkins as admin:
    • click on Manage Jenkins
    • click on Configure System
    • in the Jenkins Location section in Jenkins URL enter: http://ag-bie.oztaxa.com/jenkins/
  4. restart jenkins and nginx services
    $ sudo systemctl restart jenkins.service
    $ sudo systemctl restart nginx.service
mbohun commented 6 years ago

alternative approach

<VirtualHost *:80>
    ServerName example.com

    ProxyRequests On
    ProxyPass / http://localhost:8080/demo1/
    ProxyPassReverse / http://localhost:8080/demo1/

    <Location "/sample">
      Order allow,deny
      Allow from all
    </Location>

</VirtualHost>

my old (apache2) notes:

moziauddin commented 4 years ago

Jenkins is not using nginx and can be access using the /jenkins permalink against the hostname.