【发布时间】:2021-07-25 05:45:42
【问题描述】:
如何在 nginx 中使用以下 htaccess 规则?
所以如果用户访问http://lovelythings.buzz/api 或img 应该使用本地端口8080。
但是当尝试访问其他路由http://lovelythings.buzz时,它会被代理到端口3000或3001
这我已经在 .htaccess 上为 Apache2 服务器实现了。
但是在其他服务器上我安装了 Nginx 并且 Nginx 不支持.htaccess。
下面是.htaccess,我正在尝试在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]
【问题讨论】:
标签: .htaccess nginx vue-storefront