logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Reverse proxy, rewrite
Author
RevArie



Joined: 07 Aug 2015
Posts: 5
Location: Rotterdam, Netherlands

PostPosted: Fri 07 Aug '15 20:17    Post subject: Reverse proxy, rewrite Reply with quote

Apache 2.4.7 on Ubuntu 14.04

I have 2 applications on this server:
1. Spotweb - https://github.com/spotweb/spotweb
2. Sabnzbd - http://wiki.sabnzbd.org/install-ubuntu-repo.

Goal: Access both applications on same server as:
1. nzb.example.org/spotweb -- Spotweb
2. nzb.example.org/ -- Sabnzbd

1. Spotweb config
Code:
           Alias /spotweb "/var/www/html/spotweb"
        <Directory /var/www/html/spotweb/>
                Options FollowSymLinks
                Require all granted
        </Directory>



2. Sabnzbd config
Code:
                ServerName nzb.example.org
                ServerAlias nzb.example.org
                ProxyPreserveHost On
                ProxyRequests off
                ProxyPass /nzb http://nzb.example.org:8800/
                ProxyPassReverse /nzb http://nzb.example.org:8800/

Result for http://nzb.example.org/spotweb is a rewrite to: http://localhost:8800/sabnzbd

Result for http://nzb.example.org/ is good.

Confusing stuf. Crying or Very sad
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 10 Aug '15 17:41    Post subject: Reply with quote

Is there a rewrite rule in the httpd.conf or in a .htaccess file in the root?
Back to top
RevArie



Joined: 07 Aug 2015
Posts: 5
Location: Rotterdam, Netherlands

PostPosted: Mon 10 Aug '15 17:46    Post subject: Reply with quote

Yes, there is a .htaccess file in the root, but without rewrite rules, because I have commented them.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 10 Aug '15 17:49    Post subject: Reply with quote

I wonder...

you can try to disable the reverse proxy of the spotweb

Code:
ProxyPass /spotweb !
ProxyPassReverse /spotweb !


I'm not so sure if that helps. Trial and error.
Back to top
RevArie



Joined: 07 Aug 2015
Posts: 5
Location: Rotterdam, Netherlands

PostPosted: Mon 10 Aug '15 18:43    Post subject: Reply with quote

James! Thanks ever so much! This was spot on. The full config is now quite simple and effective.
Code:
<VirtualHost *:80>
        ServerName nzb.example.org
        DocumentRoot /var/www/html/spotweb

        Alias /spotweb "/var/www/html/spotweb"
        <Directory /var/www/html/spotweb/>
                Options FollowSymLinks
                Require all granted
        </Directory>

        ProxyPreserveHost On
        ProxyRequests off
        ProxyPass /spotweb !
        ProxyPassReverse /spotweb !
        ProxyPass / http://nzb.example.org:8800/
        ProxyPassReverse / http://nzb.example.org:8800/

        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 10 Aug '15 22:18    Post subject: Reply with quote

Now I get the issue!

You spotweb folder as the document root and also as an alias. That is Why the .htaccess did mess. It would have been a lot easier if you just out the document root to /var/www/html even tho it is empty. Then you don't need the alias.
Back to top
RevArie



Joined: 07 Aug 2015
Posts: 5
Location: Rotterdam, Netherlands

PostPosted: Tue 11 Aug '15 5:37    Post subject: Reply with quote

OK, lesson learned. Next time I will post full config. Noticed the document root, and changed this as well. Thanks again. Very Happy
Back to top


Reply to topic   Topic: Reverse proxy, rewrite View previous topic :: View next topic
Post new topic   Forum Index -> Apache