首页 > 解决方案 > 如何使用 Apache httpd 将请求从一个特定端口转发到另一个端口?

问题描述

我的要求http://localhost/services/pdf/module/generate/

http://localhost:8080/services/pdf/module/generate/

写什么httpd.conf来做到这一点。

标签: apachehttpd.conf

解决方案


您可以使用以下重定向规则将请求从特定端口转发到另一个 Apache httpd。您可以根据需要调整端口。

RewriteEngine On
RewriteCond %{SERVER_PORT} ^80
RewriteRule ^/(.*) http://%{HTTP_HOST}:8080/$1 [L,R]

推荐阅读