Squid has a mechanism by which incoming URL's can be passed to an
external program to be rewritten and the reverse proxy subsequently
calls out to the rewritten URL
http://wiki.squid-cache.org/SquidFaq/SquidRedirectors
Is there a way to emulate this from within nginx
Thanks, Yusuf
i installed Wordpress today on nginx and everything seems ok except one
"small" issue, i don't know how to convert the rewrite rules.
So if anybody has any experience or knows how to do it i'd be gratefull
cause they have only Apache examples :(
RewriteEngine On
RewriteBase /
# Rewrite www.domain.com to domain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*) http://%1/$1 [R,L]
#uploaded files
RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Thank you.
I've been pounding against this for a little while and it's time to
ask for help. I'm not sure if it's possible since google has found no
similar stories but I can hope.
We're trying to take a query string and replace the ?, &, and = with
/. We're going to try to do caching on disk this way. Naturally I
would appreciate advice about whether this is a good idea or not but
that's not the soul of this question.
Here's the code I've tried to create.
if ($query_string ~ ^(s!(\?|&|=)(?:)!/!g)$) {
set $new_url $1;
rewrite ^(.*)$ $new_url.html break;
}
Thank you in advance,
Chuck Vose
Performing a fresh install on Ubuntu 4.1.1 where the destination directory
(/opt/nginx) does not exist:
root@xxxxx:~/src/nginx-0.6.6# make install
make -f objs/Makefile install
make[1]: Entering directory `/home/foo/src/nginx-0.6.6'
test -d '/opt/nginx' || mkdir -p '/opt/nginx'
test -d '/opt/nginx/sbin' || mkdir -p '/opt/nginx/sbin'
test ! -f '/opt/nginx/sbin/nginx' || mv '/opt/nginx/sbin/nginx'
'/opt/nginx/sbin/nginx.old'
cp objs/nginx '/opt/nginx/sbin/nginx'
test -d '/opt/nginx' || mkdir -p '/opt/nginx'
cp conf/koi-win '/opt/nginx'
cp conf/koi-utf '/opt/nginx'
cp conf/win-utf '/opt/nginx'
test -f '/opt/nginx/mime.types' || cp conf/mime.types
'/opt/nginx'
cp conf/mime.types '/opt/nginx/conf/nginx.conf/mime.types.default'
cp: cannot create regular file
`/opt/nginx/conf/nginx.conf/mime.types.default': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/azell/src/nginx-0.6.6'
make: *** [install] Error 2
It appears that the /opt/nginx/conf directory has not been created before
the cp command.
Our project needs to redirect users to certain back end servers based
on the url. For example if the url contains a string '00um' that
should redirect the user to a certain mongrel cluster on a particular
machine.
I have tried to use something like the following:
upstream mongrel {
00um 127.0.0.1:8000;
01um 127.0.0.1:8001;
02um 127.0.0.1:8002;
set $server_key = "";
if( $request_uri ~* "id=^.*([0-9][0-9][a-z][a-z])$" ) {
set $server_key $1
}
hash $server_key
}
As you may guess the above configure is a concept and probably does
not work. I have tried some variations on this theme with out much
success.
First question is will something like this work at all or does the
hash actually just index into the upstream table or is the upstream
table a hash that can be looked up by key?
Second question is there a method to do what I am asking if the above
solution is not even close. :-)
Thank you,
David
hello,
is there a way to disable logging? i have multiple server sections
(virtual hosts) and if i remove error_log and access_log directives
from a server, logging goes to the main nginx log. these logs are huge
and useless, so i need something like "error_log off" but i don't see
anything like this in documentation.
Bob
Hi all,
I'm using nginx and what I'd like to occur is the following: I'd like
to host multiple apps, each hosted on their own Web server on
different ports on the local machine. I'd like for nginx to proxy
between these apps based on an URL path prefix, e.g.
http://localhost/path/place?query=1 --> http://localhost:8080/place?query=1
My config is pretty simple and looks like:
location / {
root /var/www/html;
}
location /path/ {
rewrite ^/path/(.*)$ $1 break;
proxy_pass http://127.0.0.1:8080;
}
However, when I click on an href="/path" link, I am sent back to the
index page. Why is it not proxying the rewritten URL back to the
instance on port 8080? How can I make it do that? Thanks for all your
help.
--
Toby DiPasquale
Hello Ngixers,
Happy sys admin day! (tomorrow)
I am trying to pass data from our PHP authorizer script all the way down
to post_action, like so:
1. fastcgi - php authorizer script - passing X-Accel-Redirect
2. the file gets sent to the user
3. Now using post_action to run another php script when the request ends
I need a way to transfer information (a key) from the 1st php script
down to the 2nd php script. Passing it in a header would be good, any
other way should also work.
Some stuff I tried that didn't work::
fastcgi_param PARAM_EXTRA_3 $upstream_http_x_session_id;
or
post_action /done/$upsteram_http_x_session_id
Any suggestions would be greatly appreciated.
Thanks!
Marc
Changes with nginx 0.6.6 30 Jul 2007
*) Feature: the --sysconfdir=PATH option in configure.
*) Feature: named locations.
*) Feature: the $args variable can be set with the "set" directive.
*) Feature: the $is_args variable.
*) Bugfix: fair big weight upstream balancer.
*) Bugfix: if a client has closed connection to mail proxy then nginx
might not close connection to backend.
*) Bugfix: if the same host without specified port was used as backend
for HTTP and HTTPS, then nginx used only one port - 80 or 443.
*) Bugfix: fix building on Solaris/amd64 by Sun Studio 11 and early
versions; bug appeared in 0.6.4.
--
Igor Sysoev
http://sysoev.ru/en/