Welcome! Log In Create A New Profile

Advanced

Migrate from Apache2: Location_Alias + rewrite + Location + PHP

Denny Fuchs
October 27, 2017 03:30AM
Hello,

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">
....
</Directory>

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" :{....}'
http://foobar/go_and_save


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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Migrate from Apache2: Location_Alias + rewrite + Location + PHP

Denny Fuchs October 27, 2017 03:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 146
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready