Migrate from Apache2: Location_Alias + rewrite + Location + PHP

Denny Fuchs linuxmail at 4lin.net
Fri Oct 27 07:28:55 UTC 2017


I have standard Apache2 Vhost configuration and I try to understand, how 
to migrate to Nginx :-)

Apache2 has simple Vhost:

<VirtualHost ...:80>
Alias /dispatcher "/foo/bin/dispatch.php"

<Directory "/opt/foo/web">

We need an alias for a file, which is not in the www_root ...

In the "/opt/foo/web" we have a .htaccess, which contains:

RewriteEngine On
RewriteCond %{REQUEST_URI} !dispatcher$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .*/dispatcher [QSA,L]

So, every call on http://foobar/whatever is rewritten to the alias 
/dispatcher/dispatch.php which is located /opt/foo/web/dispatch.php

For example:

curl --header 'Content-Type: application/json' --data '{"data" :{....}' 

I'm a bit confused, if I need try_file, or rewrite and that in 
combination with the alias, outside the www_root and with PHP7.

Can somebody help :-)

cu denny

More information about the nginx mailing list