Page 1 of 1
sabnzbd and apache2
Posted: February 1st, 2008, 1:49 am
by emarkd
I really want to hide sabnzbd and it's cherrypy server behind my apache2 installation, but I can't seem to get it working. I've read the very limited docs available from cherrypy about using mod_rewrite, but they're not in-depth enough. I keep getting protocol handler errors. On the other end is the apache docs that go way more in depth than I need and I can't find what I need in all that information. Can anyone who has this working point me in the right direction? Is there a good tutorial out there that I'm missing?
Re: sabnzbd and apache2
Posted: February 1st, 2008, 9:14 am
by switch
I assume you mean these tutorials:
http://tools.cherrypy.org/wiki/BehindApache yes?
Try using this way, it looks easier:
http://sourceforge.net/forum/message.php?msg_id=4712352
Sorry I can't be of more help, never set sab up behind apache.
Re: sabnzbd and apache2
Posted: February 1st, 2008, 10:26 am
by emarkd
Thanks for your reply and interest in my question. I tried it using only mod_proxy as well and it wouldn't work for me. I just get the html, no CSS or JS makes it through. I've made a bit of progress, though. Using the mod_rewrite module, I've written these two simple rules for the redirection:
RewriteRule ^/nzb$
http://localhost:8080/sabnzbd/ [P]
RewriteRule ^/nzb/$
http://localhost:8080/sabnzbd/ [P]
They're supposed to redirect any traffic to my server at /nzb to the CherryPy server in the background by funneling it through mod_proxy. It works just like using mod_proxy without the rewrite. I get the html, but no CSS or JS. If I change those flags to [R], then it skips the mod_proxy and does a real redirect. That works fine and I may just consider it good enough if I can't get mod_proxy to play nice, but then I have to open port 8080 to the outside and I really didn't want to.
Anybody have any ideas?
Re: sabnzbd and apache2
Posted: February 1st, 2008, 10:33 am
by switch
Been a long time since I have messed around with mod_rewrite, but mayb add this in?
RewriteRule ^/nzb/$
http://localhost:8080/sabnzbd/$1 [P]
Re: sabnzbd and apache2
Posted: February 1st, 2008, 12:22 pm
by emarkd
Thanks again for the suggestion, but that didn't get it either. In my poking around, though, I've uncovered some new information. I didn't think about my sab login cookie earlier and when I clear that cookie, things change a bit.
When I go to /nzb on my apache server, it actually shows the login fine (I know there's no CSS or anything there), but when I enter my credentials, I get a 404 /sabnzbd/ not found, so it's like CherryPy is redirecting me again somehow. So I changed my rules to use /sabnzbd as the root on apache to try and cover up the redirect. Now when I go to /sabnzbd on apache, I get the login screen from CherryPy and after logging in it redirects me to sab, but still with no CSS or JS. Do I have to do something to CherryPy or SAB to make this work?
Re: sabnzbd and apache2
Posted: February 1st, 2008, 4:55 pm
by emarkd
Thanks, but that's not it either. I tried both Plush and the default and they both give just HTML through the proxy. Going directly to CherryPy works fine every time.
Re: sabnzbd and apache2
Posted: February 2nd, 2008, 3:39 am
by shypike
This is what I have in my Apache 2.2 setup to handle SABnzbd.
Not quite sure which parts are specific for SAB and I may have enabled additional Apache modules.
http://sabnzbd.wikidot.com/howto-apache
Re: sabnzbd and apache2
Posted: February 2nd, 2008, 10:00 pm
by emarkd
Thanks a lot! That works great and it's much simpler than what I was trying to do. That makes SAB, which is already great, that much more useful. I appreciate everyone's help on this.
Re: sabnzbd and apache2
Posted: July 26th, 2008, 7:15 am
by mantis006
The way I do it is by utilizing mod_proxy in apache. I setup a vhost to handle a lot of my "LAN only services" like sab. By doing this, you'll be able to utilize all those wonderful apache authentication and security modules (SSL, AUTH_MYSQL, etc) to really secure your sabnzbd web interface.
I run Apache/2.2.9 on Gentoo Linux. Any of this stuff can just be thrown in httpd.conf; but, modular config files tend to be cleaner
/etc/apache2/vhosts.d/00_default_vhost.conf
Code: Select all
...
<VirtualHost *:80>
Include /etc/apache2/vhosts.d/admin_vhost.include
</VirtualHost>
...
/etc/apache2/vhosts.d/admin_vhost.include
Code: Select all
... #declare all that good stuff for vhost, this below part is the meat and potatoes for this discussion
<IfDefine PROXY> #passed with a -D parameter to the server daemon, check your init/conf script to see where to put this
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /sabnzbd/ http://localhost:8080/sabnzbd/
<Location /sabnzbd/>
#some authentication stuff, nothing too special - just some simple stuff like passwd file locaitons, group file locations, etc
Include /etc/apache2/modules.d/basic_auth.include
AuthName "whatever you want the prompt to say..."
require group sabnzbd # or just valid-user, as i said-doesn't matter
ProxyPassReverse http://localhost:8080/sabnzbd/
</Location>
</IfDefine>
...
So that's the fun part. This is just a common question i see thrown around an awful lot with regards to web UIs so I figured I'd just post my findings SOMEWHERE...
Hope that helps someone.
Re: sabnzbd and apache2
Posted: December 7th, 2008, 11:58 am
by methanoid
I'm trying to get the same effect (SAB running behind Apache).... but running Apache for Windows. Just done a standard install and popped the text at the bottom of httpd.conf
ProxyRequests On
ProxyVia On
Order deny,allow
Deny from all
Allow from all
order deny,allow
deny from all
allow from all
ProxyPass
http://localhost:8088/sabnzbd
ProxyPassReverse
http://localhost:8088/sabnzbd
EDIT: mod_proxy.so has to be enabled also... spotted that (I'm using Windows Apache)... but it does nothing!!
Re: sabnzbd and apache2
Posted: December 7th, 2008, 3:19 pm
by shypike
Don't use this particular setup, you'll end up running an anonymous proxy.
Use this setup:
http://sabnzbd.wikidot.com/howto-apache
BTW: this was only tested on Ubuntu.
Re: sabnzbd and apache2
Posted: December 8th, 2008, 5:25 pm
by methanoid
well that link didnt work either....or the procedure.
First off you need to load Mod_Proxy and co... I *think* these
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
ProxyRequests Off
order deny,allow
deny from all
allow from all
ProxyPass
http://localhost:32768/gui
ProxyPassReverse
http://localhost:32768/gui
order deny,allow
deny from all
allow from all
ProxyPass
http://localhost:9000/sabnzbd
ProxyPassReverse
http://localhost:9000/sabnzbd
The code worked perfectly for running utorrent (obviously different port numbers and hardcoded URL is /gui) but for SABnzbd it gives me a 503 error all the time
"Service Temporarily Unavailable"
I get that if I type
http://192.168.0.208/sabnzbd/
http://localhost/sabnzbd/
http://webaddress.com/sabnzbd/
http://192.168.0.208/sabnzbd
http://localhost/sabnzbd
http://webaddress.com/sabnzbd
Any ideas?
Re: sabnzbd and apache2
Posted: December 11th, 2008, 5:08 pm
by methanoid
Thanks to Shy for the email. It didnt work but made me look again at the issue. If I had used my head I would have looked in the LOG and seen it was refusing a localhost connection. So I replaced with IP address and it works fine. Strange, I can use localhost for uTorrent but SAB needed a specific IP addy. Oh well.. it works which is all that matters to me!!!
For the record;
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
ProxyRequests Off
#
#order deny,allow
#deny from all
#allow from all
#ProxyPass
http://localhost:32768/gui
#ProxyPassReverse
http://localhost:32768/gui
#
order deny,allow
deny from all
allow from all
ProxyPass
http://192.168.0.208:9000/sabnzbd
ProxyPassReverse
http://192.168.0.208:9000/sabnzbd
(and making sure ServerName is defined and file locations earlier in the conf)
Re: sabnzbd and apache2
Posted: December 11th, 2008, 5:18 pm
by shypike
methanoid wrote:
I can use localhost for uTorrent but SAB needed a specific IP addy. Oh well.. it works which is all that matters to me!!!
Weird, I have my SABnzbd running on localhost all the time.