mirror of
https://github.com/PowerDNS-Admin/PowerDNS-Admin.git
synced 2026-04-25 08:45:55 +03:00
[GH-ISSUE #17] Add wsgi example #13
Labels
No labels
bug / broken-feature
bug / broken-feature
docs / request
feature / request
help / other
mod / help-wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/PowerDNS-Admin-PowerDNS-Admin#13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TacoScheltema on GitHub (Mar 30, 2016).
Original GitHub issue: https://github.com/PowerDNS-Admin/PowerDNS-Admin/issues/17
Just a small suggestion to add an example configuration for running PowerDNS-Admin in apache.
I managed to get it to work on a debian 8.3 machine as follows:
My PowerDNS-Admin files are located under /opt/powerdnsadmin and I've created a user called pdnsadmin and a group called pdnsadmin.
change the owner of /opt/powerdnsadmin and everything within it:
sudo chown -R pdnsadmin:pdnsadmin /opt/powerdnsadmininstall libapache2-mod-wsgi:
sudo apt-get install libapache2-mod-wsgicreate /opt/powerdnsadmin/powerdnsadmin.wsgi with the following content:
(I'm not sure if the line
from config import PORTis needed in the wsgi file.)add the following to your apache virtualhost:
Restart apache.
This setup is working for me.
@TacoScheltema commented on GitHub (Apr 10, 2016):
I ran into a small issue when changing the reverse proxy vhost to use https, the url scheme returned by the application is http and unfortunately my knowledge about python/flask isn't enough to get this to work.
I found several suggestions on how to solve this, one that looked the most promising can be found here: http://flask.pocoo.org/snippets/35/ but I don't know how to implement it. would it be possible to add this as a feature request?
@ngoduykhanh commented on GitHub (Apr 10, 2016):
@TacoScheltema : Which software are you using as a reverse proxy ? is it nginx ? if yes, make sure you set proxy header, for example:
And yes, it has some redirection from https to http (when login/logout). It seems that Flask's
url_foruse http schema by default. Let me take a look to fix this.@TacoScheltema commented on GitHub (Apr 10, 2016):
I use apache, I added:
RequestHeader add X-Forwarded-Ssl onbut I'll see if I can find the apache equivalent of the headers you suggest.
Thanks!
@ngoduykhanh commented on GitHub (Apr 10, 2016):
I've pushed commit
df045cb2e5to add ProxyFix() middleware component to fix the HTTPS redirection issue. I am using nginx as reverse proxy and it work fine for me with this proxy header set:I am not sure about Apache. Can you checkout the new code and use
RequestHeader add X-Forwarded-Proto httpsin Apache SSL vhost ?@TacoScheltema commented on GitHub (Apr 11, 2016):
Just tried it and it works! Awesome work!
For anyone interested: my setup is as follows:
Server A:
added a user called pdnsadmin, then
chown -R pdnsadmin:pdnadmin /opt/powerdnsadminadded these lines to the apache vhost, in my case I'm using 000_default as there's no other vhosts on this server:
create the file /opt/powerdns/powerdnsadmin/powerdnsadmin.wsgi:
Server B (reverse proxy server):
create a virtualhost for powerdns:
'vim /etc/apache2/sites-available/powerdns.conf`
and add the following: