fix redirect to device page after OPML upload
[mygpo.git] / mygpo.lighttpd.conf
blobe5ed8b50116c261300092bf033dc2c7f416fc725
2 # my.gpodder.org configuration file for lighttpd
4 # This file is part of my.gpodder.org.
6 # my.gpodder.org is free software: you can redistribute it and/or modify it
7 # under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or (at your
9 # option) any later version.
11 # my.gpodder.org is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
14 # License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
21 # How to setup for lighttpd (on Debian):
22 #   - Copy this file to /etc/lighttpd/
23 #   - Edit var.mygpo_home and var.mygpo_domain below
24 #   - Add the following line to /etc/lighttpd/lighttpd.conf:
25 #     include "mygpo.lighttpd.conf"
27 # http://iamtgc.com/2007/07/04/django-on-lighttpd-with-fastcgi/
28 # http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/
31 var.mygpo_home = "/srv/mygpo"
32 var.mygpo_domain = "gpodder.net"
35 $SERVER["socket"] == ":443" {
36     ssl.engine  = "enable"
37     ssl.pemfile = var.mygpo_home + "/ssl/mygpo.pem"
38     ssl.ca-file = var.mygpo_home + "/ssl/gd_bundle.crt"
41 $HTTP["host"] =~ "^(my\.gpodder\.org|(www\.|ipv6\.|ipv46\.)?gpodder\.net)" {
42     server.document-root = var.mygpo_home + "/htdocs",
43     server.errorlog = var.mygpo_home + "/logs/error.log",
44     accesslog.filename = var.mygpo_home + "/logs/access.log",
45     accesslog.format = "%h %V %u %t \"%r\" %>s %b %T \"%{Referer}i\" \"%{User-Agent}i\"",
47     setenv.add-environment = (
48         "PYTHON_EGG_CACHE" => "/tmp",
49     )
51     fastcgi.server = (
52                 "/mygpo.fcgi" => (
53                         "main" => (
54                                 "bin-path" => var.mygpo_home + "/mygpo.fcgi",
55                                 "socket" => "/tmp/mygpo-" + var.mygpo_domain + ".sock",
56                                 "check-local" => "disable",
57                                 "min-procs" => 1,
58                                 "max-procs" => 3,
59                         )
60                 ),
61         )
63     $HTTP["url"] =~ "^/media/" {
64         expire.url = ( "" => "access plus 1 days" )
65     }
67     $HTTP["url"] =~ "^/media/logo/" {
68         expire.url = ( "" => "access plus 7 days" )
69     }
72     # Deprecated Hostnames
73     $HTTP["host"] =~ "(my\.gpodder\.org|www\.gpodder\.net)" {
75         # Redirect for all non-API requests
76         $HTTP["url"] !~ "^(/api/.*|.*\.(opml|json|jsonp|txt))$" {
77             url.redirect = (
78                 "^/(.*)$" => "http://gpodder.net/$1"
79             )
80         }
82         url.rewrite-once = (
83             "^(/api/.*|.*\.(opml|json|jsonp|txt))$" => "/mygpo.fcgi$1",
84         )
85     }
87     # Valid Hostnames
88     $HTTP["host"] =~ "^(ipv6\.|ipv46\.)?gpodder\.net" {
89         url.rewrite-once = (
90             "^(/media.*)$" => "$1",
91             "^/(favicon\.ico|favicon\.png|robots\.txt)$" => "/$1",
92             "^/(clientconfig\.json)$" => "/$1",
93             "^(/.*)$" => "/mygpo.fcgi$1",
94         )
95     }
99 $HTTP["host"] !~ "^(my\.gpodder\.org|(www\.|ipv6\.|ipv46\.)?gpodder\.net)" {
100     url.redirect = (
101         "" => "http://gpodder.net/"
102     )