0

How to use this following htaccess rules in nginx?

So if a user visits http://lovelythings.buzz/api or img it should use local port 8080.

But when tries to visit other routes http://lovelythings.buzz it is to be proxied on port 3000 or 3001

This I have already implemented on .htaccess for Apache2 server.

but on other server I have Nginx installed and Nginx does not support .htaccess.

Following is the .htaccess, I am trying to run on Nginx.

DirectoryIndex
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} dev.farrwest.com
RewriteRule  ^api(.*)$  http://localhost:8080/api$1 [P,L]
RewriteRule  ^img/(.*)$  http://localhost:8080/img/$1 [P,L]
RewriteRule ^(.*)?$ http://localhost:3001/$1 [P,L]
4

1 に答える 1