Lighttpd mod_rewrite vs. apache mod_rewrite with Django and FastCGI

During the migration process from installing Django FastCgi to Apache, I connect to one in lighttpd.

In Apache, I used the fcgi configuration described in the Django docs. The main part is to rewrite all my non-static URLs to be /mysite.fcgi/$1:

RewriteRule ^/(.*)$ /mysite.fcgi/$1 [QSA,L]

and then forwarding all requests for /mysite.fcgi for FastCGI:

<IfModule mod_fastcgi.c>
    FastCGIExternalServer /opt/www/mysite.fcgi -host 127.0.0.1:8000
</IfModule>

The setup worked on Django. If, for example, I went to http://www.mydomain.com/help/, and I typed {{ request.get_full_path }}in a template, the result was /help/. Life was good, and I was happy. However, I ran into some problems that make me switch to a web server that supports more simultaneous connections than Apache can give me.

lighttpd. . URL- mod_rewrite:

url.rewrite-once = (            "^ (/media/.)$" = > "$ 1",            "^/favicon.ico $" = > "/med/img/favicon/favicon.ico",            "^ (/.) $" = > "/mysite.fcgi$1",       )

FastCGI/mysite.fcgi:

   fastcgi.server = (
       "/mysite.fcgi" => (
           "main" => (
               "host" => "127.0.0.1",
               "port" => 8000,
               "check-local" => "disable",
           )
       ),
   )

, Django . , http://www.mydomain.com/help/ {{ request.get_full_path }} , /mysite.fcgi/help/. .

, Django , SSL. , sslmiddleware "Stephen Zabel - sjzabel@gmail.com" http://www.djangosnippets.org/snippets/240/. request.get_full_path, lighttpd, Apache. request.path.

- ? , lighttpd mod_rewrite , mod_rewrite Apache. , lighttpd FastCGI Django, sslmiddleware, . sslmiddleware, , mod_rewrite lighttpd URL-.

30- !

+3
2

FORCE_SCRIPT_NAME " settings.py fastcgi?

FORCE_SCRIPT_NAME=""
+3

http://redmine.lighttpd.net/issues/show/729, lighttpd.

, 1.4.23 "fix-root-scriptname" = > "enable" fcgi.

+1

Source: https://habr.com/ru/post/1712258/


All Articles