<div dir="ltr">Hello,<div><br></div><div>My understanding is on Apache rules like follow and convert it to nginx</div><div><br></div><div>If anyone request anything except follow URI /file/, /install/, /design/, /plugins/, /phpmyadmin/ then nginx will forward anything to /index.php?do=anything</div>
<div><br></div><div><div>RewriteCond %{REQUEST_URI} !^/file/.*</div><div>RewriteCond %{REQUEST_URI} !^/install/.*</div><div>RewriteCond %{REQUEST_URI} !^/design/.*</div><div>RewriteCond %{REQUEST_URI} !^/plugins/.*</div><div>
RewriteCond %{REQUEST_URI} !^/phpmyadmin/.*</div><div>RewriteRule ^(/.*)$ /index.php?do=$1 [L]</div></div><div><br></div><div>nginx</div><div><br></div><div>location / {</div><div><div>if ( $request_uri !~ ^(/file/|/install/|/design/|/plugins/|/phpmyadmin/)) {</div>
<div>rewrite ^(/.*)$ /index.php?do=$1;</div><div>}</div></div><div>}</div><div><br></div><div>Is this right ? It works on my server. I'm confusing where I need to put this rewrite. Am I right ?</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 10:01 AM, Jonathan Matthews <span dir="ltr"><<a href="mailto:contact@jpluscplusm.com" target="_blank">contact@jpluscplusm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 30 April 2013 03:36, tseveendorj <<a href="mailto:tseveendorj@gmail.com">tseveendorj@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I have difficulty to convert apache like rewrite to nginx. This is my config<br>
> file of virtualhost on nginx. <a href="http://pastebin.com/HTtKXnFy" target="_blank">http://pastebin.com/HTtKXnFy</a><br>
<br>
</div>OMFG. You win today's prize for "Nginx config I am least likely even<br>
to /try/ and change". Congrats! ;-)<br>
<div class="im"><br>
> My installed php script should have following rewrite<br>
> <a href="http://pastebin.com/M2h3uAt3" target="_blank">http://pastebin.com/M2h3uAt3</a><br>
><br>
> Currently any requested php code displayed it's source on browser. How could<br>
> I migrate ?<br>
<br>
</div>You need to start small. Learn how Nginx does its thing in one small<br>
area and when you've understood that, move on the next.<br>
<br>
At the moment, you have literally picked up your apache config and<br>
dumped it into Nginx's config syntax. You are unlikely to succeed if<br>
you don't learn how to work *with* Nginx, instead of trying just to<br>
make it behave like Apache.<br>
<br>
This may not be the "here's your config; I fixed it" reply you were<br>
looking for, but it's the best I can give you. Your Nginx config is<br>
/horrible/, and I'm not going to spend my time deciphering it! :-)<br>
<br>
Have a *really* good read of<br>
<a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite" target="_blank">http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite</a> and<br>
<a href="http://wiki.nginx.org/HttpRewriteModule" target="_blank">http://wiki.nginx.org/HttpRewriteModule</a>. They'd be good places to<br>
start ...<br>
<br>
J<br>
--<br>
Jonathan Matthews // Oxford, London, UK<br>
<a href="http://www.jpluscplusm.com/contact.html" target="_blank">http://www.jpluscplusm.com/contact.html</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>