port to subdomain

9,009

You'll need to enable mod_proxy in Apache2 first. So run these commands as root, or sudo:

a2enmod proxy
a2enmod proxy_http

You'll then need to restart apache:

/etc/init.d/apache2 restart

Your HUDSON vhost file:

<VirtualHost *:80>
ServerName hudson.example.com
ProxyPass         /  http://localhost:8080/hudson
ProxyPassReverse  /  http://localhost:8080/hudson
ProxyRequests     Off

# Local reverse proxy authorization override
# Most unix distribution deny proxy by default 
# (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
<Proxy http://localhost:8080/hudson*>
  Order deny,allow
  Allow from all
</Proxy>
</VirtualHost>

Restart Apache one more time to commit the new vhost:

/etc/init.d/apache2 restart
  • Hudson Documention on running it behind Apache: LINK
  • Apache2.2 doc on running ProxyPass subdomains: LINK
Share:
9,009

Related videos on Youtube

takeshin
Author by

takeshin

Updated on September 17, 2022

Comments

  • takeshin
    takeshin over 1 year

    I have installed Hudson using apt-get, and the Hudson server is available on example.com:8080.

    For example.com I use standard port *:80 and some virtual hosts set up this way:

    # /etc/apache2/sites-enabled/subdomain.example.com
    <Virtualhost *:80>
      ServerName subdomain.example.com
      ...
    </Virtualhost>
    

    Here is info about Hudson process:

    /usr/bin/daemon --name=hudson --inherit --env=HUDSON_HOME=/var/lib/hudson --output=/var/log/hudson/hudson.log --pidfile=/var/run/hudson/hudson.pid -- /usr/bin/java -jar /usr/share/hudson/hudson.war --webroot=/var/run/hudson/war
      987 ?        Sl     1:08 /usr/bin/java -jar /usr/share/hudson/hudson.war --webroot=/var/run/hudson/war
    

    How should I forward:

        http:// example.com:8080  
    

    to:

        http:// hudson.example.com
    
  • takeshin
    takeshin about 14 years
    Thanks for the answer. This works (I only had to change :8080/hudson to :8080), but now the stylesheets are not loading. When I try to access them directly I get: The proxy server could not handle the request GET /static/10302538/css/style.css. Reason: DNS lookup failure for: localhost:8080static
  • David Rickman
    David Rickman about 14 years
    make sure 127.0.0.1 localhost is in your /etc/hosts file.
  • takeshin
    takeshin about 14 years
    It is: 127.0.0.1 localhost 192.168.1.2 example.com
  • David Rickman
    David Rickman about 14 years
    Found a possible answer. Put a trailing slash after the :8080. You removed it when you deleted the word "hudson" from the vhost config file. So it would look like:: localhost:8080 on applicable lines. Restart apache and let me know how that works out.