Rewriting Base URL when passing

adam estes wtymdjs at gmail.com
Wed Feb 15 20:40:56 UTC 2012


worker_processes 1;
user nginx nginx;

events {
        worker_connections 1024;
}

http {
        include mime.types;
        default_type application/octet-stream;
        sendfile on;
        keepalive_timeout 65;

        # I have to set min length to 0 and http version to 1.0 or it won't
compress
        # the XML-RPC (SCGI) responses. Those responses can be quite large
if you're
        # using many torrent files.
        gzip on;
        gzip_min_length 0;
        gzip_http_version 1.0;
        gzip_types text/plain text/xml application/xml application/json
text/css application/x-javascript text/javascript$


        server {
                listen 80;
                #error_log   /var/log/nginx/error.log error;
                server_name localhost;

                location ~ /\.ht {
                        deny all;
                }

                location ~ /\.svn {
                        deny all;
                }

                location / {
                        root /home/sites/forum/;
                        index index.php index.html index.htm;
                }
  location ~ \.php$ {
                        root "/home/sites/forum/";
                        fastcgi_pass unix:/etc/phpcgi/php-cgi.socket;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
                        include fastcgi_params;
                }
                location ~ ^/django(?P<django_path>.*?)$ {
                        uwsgi_param PATH_INFO $django_path;
                        uwsgi_pass 127.0.0.1:9001;
                        include uwsgi_params;
                }


#               location ~ ^/RPC00001$ {
#                       include scgi_params;
#                       scgi_pass
unix:/home/rtorrent/rtorrent/session/rpc.socket;
#                       auth_basic "idk";
#                       auth_basic_user_file
"/usr/local/nginx/rutorrent_passwd_rtorrent";
#               }
        }
        server {
                listen 443;
                server_name localhost;
                auth_basic "My ruTorrent web site";
                auth_basic_user_file "/usr/local/nginx/rutorrent_passwd";

                ssl on;
                ssl_certificate /usr/local/nginx/rutorrent.pem;
                ssl_certificate_key /usr/local/nginx/rutorrent.pem;

                location ~ ^/rutorrent/(?:share|conf) {
                        deny all;
                }

                location ~ /\.ht {
                        deny all;
 }

                location / {
                        root /var/rutorrent;
                        index index.php index.html index.htm;
                }

                location ~ \.php$ {
                        root "/var/rutorrent";
                        fastcgi_pass unix:/etc/phpcgi/php-cgi.socket;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
                        include fastcgi_params;
                }

#               location ~ ^/RPC00001$ {
#                       include scgi_params;
#                       scgi_pass
unix:/home/rtorrent/rtorrent/session/rpc.socket;
#                       auth_basic "My ruTorrent web site";
#                       auth_basic_user_file
"/usr/local/nginx/rutorrent_passwd_rtorrent";
#               }
        }
}

And I don't think it was compiled with debugging support :|

On Wed, Feb 15, 2012 at 3:35 PM, Valentin V. Bartenev <ne at vbart.ru> wrote:

> On Thursday 16 February 2012 00:15:51 adam estes wrote:
> > It seems to actually be rewriting the url now. The issue is with how its
> > doing it
> >
> > when I visit 69.x.x.x./django/admin/
> >
> > it rewrites it to 69.x.x.x/admin/
> >
> > which is then processed by nginx again I'm guessing because it loads the
> > IPB admin folder, and not the django admin url like it should if it was
> > being handled by django.
> >
>
> If you didn't set any "rewrite" then nginx doesn't rewrite url and it
> doesn't
> process it again. The "location" and "uwsgi_param" directives can't do
> that.
>
> Could you show your full config?
>
>  wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120215/706f6b9b/attachment-0001.html>


More information about the nginx mailing list