Nginx配置反向代理并重写URLFirst Post: 2020-01-22Last Update: 2023-08-22nginx.conf1234567# ...location /api { rewrite /api/(.+)$ /$1 break; proxy_pass http://localhost:3000 ; proxy_redirect off;}# ... 访问:http://localhost/api,会代理到http://localhost:3000,http://localhost:3000路由中无需额外写/api,nginx会自动重写。 ∧ ≡