REQUEST_URI makes it work.<br><br>Everythings works great, I will write this up for future reference for myself and others, and refer to you and this mailinglist. I will mail the link.<br><br>Thanks for your help and nginx!,
<br><br><div><span class="gmail_quote">On 12/13/07, <b class="gmail_sendername">Igor Sysoev</b> &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu, Dec 13, 2007 at 03:04:54PM +0100, Abdul-Rahman Advany wrote:<br><br>&gt; Works great, only know it returns a 404 error with every request :( is there<br>&gt; a way I can remove the header send by nginx?<br><br>By the way, what method does work - REQUEST_URI or PATH_INFO ?
<br><br>&gt; On 12/13/07, Igor Sysoev &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; On Thu, Dec 13, 2007 at 09:06:05AM +0100, Abdul-Rahman Advany wrote:<br>&gt; &gt;<br>&gt; &gt; &gt; Hi guys,
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; I am running php with nginx, with fastcgi. But instead of heaving my<br>&gt; &gt; urls<br>&gt; &gt; &gt; like <a href="http://www.myblog.com/index.php/bla/bla">www.myblog.com/index.php/bla/bla
</a> I would like<br>&gt; &gt; &gt; <a href="http://www.myblog.com/bla/bla">www.myblog.com/bla/bla</a>&lt;<a href="http://www.myblog.com/bla/bla.">http://www.myblog.com/bla/bla.</a>&gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; With the setup at the end of the mail, it redirect if a file can&#39;t be
<br>&gt; &gt; found<br>&gt; &gt; &gt; to index.php, but I get the content of index.php back. (So if I go to<br>&gt; &gt; &gt; <a href="http://www.myblog.com/bla/bla">www.myblog.com/bla/bla</a>).<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; But I also have other requests that should not be rewritten (directories
<br>&gt; &gt; and<br>&gt; &gt; &gt; files in the root directory). Is this possible? to redirect only if<br>&gt; &gt; &gt; <a href="http://www.myblog.com/bla/bla">www.myblog.com/bla/bla</a> doesn&#39;t exist to a normal request to the root
<br>&gt; &gt; &gt; directory and send that to the fastcgi process?<br>&gt; &gt;<br>&gt; &gt; How does wordpress find what URI you request ?<br>&gt; &gt; I know that wordpress may use REQUEST_URI (it should already set<br>
&gt; &gt; in /etc/nginx/fastcgi.conf):<br>&gt; &gt;<br>&gt; &gt; fastcgi_param&nbsp;&nbsp;REQUEST_URI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$request_uri;<br>&gt; &gt;<br>&gt; &gt; The second way (I do not know whether Wordpress use it) is PATH_INFO:<br>&gt; &gt;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location / {<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root /var/www/blog;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error_page&nbsp;&nbsp;404 /index.php;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~ \.php$ {<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/etc/nginx/fastcgi.conf;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_pass <a href="http://127.0.0.1:8888">127.0.0.1:8888</a>;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_param&nbsp;&nbsp;PATH_INFO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$request_uri;<br>&gt; &gt;<br>&gt; &gt; fastcgi_param&nbsp;&nbsp;SCRIPT_FILENAME&nbsp;&nbsp;/var/www/blog/$fastcgi_script_name;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~*<br>&gt; &gt; ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$<br>&gt; &gt; {<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root /var/www/blog;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &gt; I really love nginx, and thanks to this mailinglist I didn&#39;t need much<br>&gt; &gt; help.<br>&gt; &gt; &gt; But most rewrite rules are written wordpress MU (multiuser) and not
<br>&gt; &gt; &gt; wordpress redux. I just need to to rewrite all request that do not<br>&gt; &gt; exists to<br>&gt; &gt; &gt; index.php and pass this to fastcgi.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; I did get this working one time.. but I can&#39;t figure out how I did it :S
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; server {<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;80;&nbsp;&nbsp;# Replace this IP and port with the right<br>&gt; &gt; &gt; ones for your requirements<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_name&nbsp;&nbsp;<a href="http://www.myblog.com">
www.myblog.com</a><br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #charset koi8-r;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #access_log&nbsp;&nbsp;logs/host.access.log<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~*<br>&gt; &gt; &gt;
<br>&gt; &gt; ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$<br>&gt; &gt; &gt; {<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root /var/www/blog;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error_page&nbsp;&nbsp;404 /index.php;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~ \.php$ {<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/etc/nginx/fastcgi.conf;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_pass
<br>&gt; &gt; &gt; <a href="http://127.0.0.1:8888">127.0.0.1:8888</a>;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_index&nbsp;&nbsp;index.php;<br>&gt; &gt; &gt;<br>&gt; &gt; fastcgi_param&nbsp;&nbsp;SCRIPT_FILENAME&nbsp;&nbsp;/var/www/blog/$fastcgi_script_name;
<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # deny access to .htaccess files, if Apache&#39;s document root<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # concurs with nginx&#39;s one<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #
<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #location ~ /\.ht {<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;deny&nbsp;&nbsp;all;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #}<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; --
<br>&gt; &gt; &gt; Abdul-Rahman Advany<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; IM: <a href="mailto:abdulrahman@advany.com">abdulrahman@advany.com</a><br>&gt; &gt;<br>&gt; &gt; --<br>&gt; &gt; Igor Sysoev<br>&gt; &gt; <a href="http://sysoev.ru/en/">
http://sysoev.ru/en/</a><br>&gt; &gt;<br>&gt; &gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; Abdul-Rahman Advany<br>&gt;<br>&gt; IM: <a href="mailto:abdulrahman@advany.com">abdulrahman@advany.com</a><br><br>--<br>Igor Sysoev<br>
<a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>Abdul-Rahman Advany<br><br>IM: <a href="mailto:abdulrahman@advany.com">abdulrahman@advany.com</a>