Rewrite

Silvio Siefke siefke_listen at web.de
Fri Apr 20 00:43:17 UTC 2012


On Fri, 20 Apr 2012 06:56:51 +0700
Edho Arief <edho at myconan.net> wrote:

> 1. you forgot to put ~ for regex match
> 2. the one you want is rewrite/return, not try_files

Thanks for help. So i have from this list, with the html files it run. 
But nginx want not use html inside php so i must change the rule.
 
> something like this may work:
> 
> location ~ ^/article-(\d+)\.php$ {
>   rewrite ^ /post.php?id=$1 last;
> }

Is the same, i become "File not found".

192.168.0.20 - - [20/Apr/2012:02:40:32 +0200] "GET /blog/article-1.php 
HTTP/1.1" 404 27 "http://silviosiefke_de/blog/index.php" "Mozilla/5.0 
(Windows NT 5.1) AppleWebKit/535.19 (KHTML, like Gecko) 
Chrome/18.0.1025.162 Safari/535.19" "-"

Regards
Silvio

gentoo-desk db # nginx -V
nginx version: nginx/1.0.15
TLS SNI support enabled
configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx 
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log 
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock 
--with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib 
--http-log-path=/var/log/nginx/access_log 
--http-client-body-temp-path=/var/tmp/nginx/client 
--http-proxy-temp-path=/var/tmp/nginx/proxy 
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi 
--http-scgi-temp-path=/var/tmp/nginx/scgi 
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi 
--with-http_addition_module --with-http_dav_module --with-http_realip_module 
--with-http_stub_status_module --with-http_sub_module --with-http_xslt_module 
--with-http_realip_module --with-pcre
--add-module=/var/tmp/portage/www-servers/nginx-1.0.15/work/agentzh-headers-more-nginx-module-137855d 
--add-module=/var/tmp/portage/www-servers/nginx-1.0.15/work/nginx_http_push_module-0.692 
--add-module=/var/tmp/portage/www-servers/nginx-1.0.15/work/nginx_upload_module-2.2.0 
--with-http_ssl_module --without-mail_imap_module --without-mail_pop3_module 
--without-mail_smtp_module --user=nginx --group=nginx



More information about the nginx mailing list