Pages

Setup Jenkins with Nginx reverse proxy

Setting up jenkins is something pretty straight forward. But configuring with Nginx is not that easy. So in this post I'm trying to ease this up for you.

Before setting up jenkins I would recommend oracle java installation. So here how it begins.

Step 1
1.Download and install java.

 sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.tar.gz"  

2.untar jdk and create JAVA_HOME in ~/.bashrc

Step 2
Jenkins setup
1.
 wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -  
 sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'  
 sudo apt-get update  
 sudo apt-get install jenkins  

To start jenkins fire up following command.

 sudo /etc/init.d/jenkins start  

To check logs

 tail -f /var/log/jenkins/jenkins.log  

To check your jenkins is up and running.
 http://<host>:8080/  


Step 3
In order to config nginx with jenkins we have do some customization.
1. Stop jenkins

 sudo /etc/init.d/jenkins stop  

2. Open jenkins script and add --prefix=/jenkins into JENKINS_ARGS

 JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/jenkins"  

3. Install nginx

 sudo aptitude -y install nginx  

4. Remove default config and add following configuration

 cd /etc/nginx/sites-available  
 sudo rm default ../sites-enabled/default  


 server {  
  listen     80;    # Listen on port 80 for IPv4 requests  
  server_name   54.194.149.122;  
  location ~ "^/static/[0-9a-fA-F]{8}\/(.*)$" {  
   #rewrite all static files into requests to the root  
   #E.g /static/12345678/css/something.css will become /css/something.css  
   rewrite "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last;  
  }  
  location /userContent {  
     #have nginx handle all the static requests to the userContent folder files  
     #note : This is the $JENKINS_HOME dir  
     root /var/lib/jenkins/;  
     if (!-f $request_filename){  
       #this file does not exist, might be a directory or a /**view** url  
       rewrite (.*) /$1 last;  
       break;  
     }  
     sendfile on;  
  }  
  location /jenkins {  
    sendfile off;  
    proxy_pass     http://127.0.0.1:8080;  
    proxy_redirect   default;  
    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;  
    #this is the maximum upload size  
    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;  
 }  
 }  

5. http://<host>/jenkins

42 comments:

  1. Thanks for sharing informative article on java application development. Your post helped to understand the career in Java.
    Java Training in Chennai
    Dot Net Training in Chennai
    PHP Training in Chennai

    ReplyDelete
  2. Wow! It was the best article , actually you have posted something new compared to others, because I read many articles related to this topic but I only get impressed with your post only, keep posting.
    Regards,
    SAP training center in chennai|SAP course chennai|SAP Training in Chennai|SAP Institutes in Chennai|SAP training in chennai

    ReplyDelete
  3. Updating with the latest technology and implementing it is the only way to survive in our niche. Thanks for making me understand through this article. You have done a great job by sharing this content in here. Keep writing article like this.

    DOT NET Training in Chennai | Dot net training | Best DOT NET Training institute in Chennai

    ReplyDelete
  4. Thanks of sharing this post…Python is the fastest growing language that helps to get your dream job in a developing area. It says every fundamental in a programming, so if you want to become an expertise in python get some training
    Regards,
    Python Training in Chennai|Python Training|SAS Training in Chennai|Angularjs training in chennai

    ReplyDelete
  5. Nice post you have done here. I am really very happy to read this. This is a very informative topic that you are chosen. keep it upCustomer Support Page

    ReplyDelete
  6. Thank you so much for sharing this wonderful article. From this i have earned more knowledge since I have been following your blog for a long time.

    Regards,
    CCNA Training in Chennai | CCNA Training Institute in Chennai | Best CCNA Training in Chennai

    ReplyDelete
  7. Good site development service providing companies are not hard to find out. Starting from the field of professional site app projects development to designing services they use to offer every facility to its customers.

    ReplyDelete
  8. WP EasyCart eCommerce module is a straightforward shopping basket module that introduces into new or existing WordPress online journals and sites. Get a full WordPress eCommerce Shopping Cart framework inside minutes! Offer retail items, advanced downloadable merchandise, blessing cards and that's only the tip of the iceberg! What's more, now with WordPress, the capable components are still simple to administrate!
    Wordpress Cart Shop

    ReplyDelete
  9. in this site Multi-level ivr plugin Introduction The WordPress Multi Level IVR Plugin comes with complete IVR solution to fulfill all your personal,,click this site

    ReplyDelete
  10. Useful Information
    one and only affiliate agency in south INDIA, earn money online from affiliate network in india

    ReplyDelete

  11. useful information

    Online recruitment for bank jobs and government jobs and you can get Notification and application to apply online for bank jobs and govt jobs

    ReplyDelete
  12. Useful information:
    General Awareness and Current Affairs with Latest Current Affairs Quiz, GK Updates, General Knowledge Last 6 Months Current Affairs, Placement Papers, Model Papers, Interview Questions @ examvalue.com

    ReplyDelete
  13. useful information

    Online recruitment for bank jobs and government jobs and you can get Notification and application to apply online for bank jobs and govt jobs

    ReplyDelete
  14. Useful Information……
    Recruitment voice contains Daily GK Updates, Bank Recruitment, Government jobs, Bank jobs, Interview Tips, Banking News, GK Updates Bank Recruitment

    ReplyDelete
  15. Nice Information:
    Telugu Cinema Contains Telugu Cinema News, Latest Movie Reviews, Actor, Actress, Movie Galleries And Many More Telugu Cinema News

    ReplyDelete
  16. Helpful Information

    Telugu70mm.com Provides Latest Telugu Movie Reviews , Telugu Political News and Other Latest Telugu Movie News

    ReplyDelete
  17. Thanks for sharing this informative content that guided me to know the details about the training offered in different technology.
    Web Designing Course in Chennai | web designing training in chennai

    ReplyDelete
  18. Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    cloud computing training in chennai | cloud computing courses in chennai

    ReplyDelete
  19. Helpful Information:

    Telugu Cinema Contains Telugu Cinema News, Telugu Movie Reviews and many more @ http://www.telugucinema.com/

    ReplyDelete
  20. Thanks of sharing this post…Java is the fastest growing language that helps to get your dream job in a best way, so if you wants to become a expertise in Java get some training on that language.
    Regards,

    Core JAVA Training in Chennai | JAVA Training in Chennai

    ReplyDelete
  21. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    Dot net training in Chennai | dot net course in Chennai

    ReplyDelete
  22. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.

    cloud computing training in chennai|cloud computing training|Cloud Computing Courses

    ReplyDelete
  23. Nice information for job seekers. Thanks for sharing the awesome information , i also recommend online Notification

    ReplyDelete
  24. Very Good Information and i also recommend Freshers job way ; as they are leading sites provides job information

    ReplyDelete
  25. Thanks , you are giving very important information for many job seekers. In my experience , i got job through Recruitment Voice and according to me it is also one of the best site.

    ReplyDelete
  26. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
    Salesforce Training in Chennai|Salesforce Training|Salesforce Training institutes in Chennai

    ReplyDelete
  27. Thanks a lot for sharing this article! Regards: sarkarinaukri

    ReplyDelete
  28. Wp easy care e-commerce module is an honest purchasing basket module that introduces into new or present WordPress online journals and websites. get a full Word press e-commerce purchasing cart framework inner minutes! provide retail objects, advanced downloadable products, blessing cards and that is best the tip of the iceberg! what's greater, now with WordPress, the successful additives are nevertheless easy to administrate!
    thank for sharing
    for more information
    oracle fusion procurement online training
    oracle fusion procurement training

    ReplyDelete

  29. Awesome article. It is so detailed and well formatted, i enjoyed reading it as well as get
    some new information too.

    Oracle Fusion HCM Training

    ReplyDelete
  30. Hii...Welcome to this blog...Your posting is really very informative.Keep sharing these types of informative....https://goo.gl/18DF3s

    ReplyDelete
  31. Nice Information
    one and only A Digital Marketing Agency in INDIA affiliate network in india

    ReplyDelete
  32. really you have shared very informative blog. it will be really helpful to many peoples. before i read this blog i didn't have any knowledge about this but now i got some knowledge.
    hadoop training in chennai

    ReplyDelete
  33. your site is great to view sir
    thank you for the valluable information
    regards

    http://www.erptree.com/course/oracle-fusion-procurement-online-training-in-kolkata/

    ReplyDelete
  34. https://www.blogger.com/comment.g?blogID=9032908587932915383&postID=4687725798574795780&page=1&token=1499152166664

    ReplyDelete
  35. This is very educational content and written well for a change Microleaves. It's nice to see that some people still understand how to write a quality post!

    ReplyDelete