1\ Use apache to access buildbot

   a)Install apache
   b)Add 'LoadModule  proxy_module         /usr/lib/apache2/modules/mod_proxy.so' to file '/etc/apache2/mods-enabled/proxy.load'
     Add 'LoadModule  proxy_http_module    /usr/lib/apache2/modules/mod_proxy_http.so' to file '/etc/apache2/mods-enabled/proxy_http.load'

   c)Add following contents to file '/etc/apache2/sites-available/default' :

  1. <Location "/buildbot/"> 
  2.          Order allow,deny 
  3.          allow from all 
  4. </Location> 
  5. ProxyPreserveHost On 
  6. ProxyRequests off 
  7. ProxyPass /buildbot/ http://localhost:9010/ 
  8. ProxyPassReverse /buildbot http://localhost:9010/ 


   Then start buildbot and run 'sudo /etc/init.d/apache2  restart',you can access buildbot through apache.
 
2\ Add authorization to access buildbot through apache
   a)Use htpasswd tool to generate a file with username and password after encrypted.
   b)Modify '/usr/lib/apache2/httpd.conf' to add authorization, you can add following contents to file '/usr/lib/apache2/httpd.conf' for 'Basic' authorization which the 'AuthType' should be 'Basic'.     

  1. <Location "/buildbot/"> 
  2.    Order allow,deny 
  3.    allow from all 
  4.    AuthName "Buildbot Access" 
  5.    AuthType Basic 
  6.    AuthUserFile /etc/apache2/buildbot_auth 
  7.    Require valid-user 
  8.  </Location> 

   The file '/etc/apache2/buildbot_auth' is the file that generated by htpasswd.Then run 'sudo /etc/init.d/apache2  restart',you will need authorization to access buildbot through apache.
   
   c)you can also apply digest authorization, that you should use htdigest to create and update the flat-files used to store usernames, realm and password.you can add following contents to file '/usr/lib/apache2/httpd.conf'.    

  1. <Location "/buildbot/"> 
  2.    Order allow,deny 
  3.    allow from all 
  4.    AuthName "buildbot" 
  5.    AuthType Digest 
  6.    AuthDigestProvider file 
  7.    AuthUserFile /etc/apache2/digest_users 
  8.    Require valid-user 
  9. </Location> 


     The file '/etc/apache2/buildbot_digest_users' is the file that generated by htdigest.Then run 'sudo /etc/init.d/apache2  restart',you will need authorization to access buildbot through apache.
     attention: The realm create by htdigest should be same as the value of 'AuthName'.

3\ Limit port 9010
  After steps above, you still can access buildbot though port 9010.You can limit the port 9010 through tool iptables ,and then other pc can not access buildbot though it.
  The command is as follow:

  1. sudo iptables -A INPUT -s localhost  -p tcp --dport 9010 -j ACCEPT 
  2. sudo iptables -A INPUT -p tcp --dport 9010 -j DROP