如何在 Windows 中使用 XAMPP 设置反向代理服务器

时间:2021-07-02 09:47:07

标签: apache xampp reverse-proxy

我正在尝试在 XAMPP 中设置反向代理服务器,以避免在我尝试访问在不同端口上运行的 API 时发生的 CORS 错误。 我已经对我的文件进行了这些更改。

API 的详细信息是:

  • host=http://127.0.0.1
  • 端口=8002

httpd-vhosts.conf

<VirtualHost *:8002>
    ProxyRequests On
    <Proxy>
        Order deny,allow
        Allow from all
    </Proxy>
    Header set Access-Control-Allow-Origin "*"
</VirtualHost>

httpd-proxy.conf

<IfModule proxy_module>
<IfModule proxy_http_module>

#
# Reverse Proxy
#
ProxyRequests Off

<Proxy *>
      Require all granted
</Proxy>

</IfModule>
</IfModule>

httpd.conf

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so

当我启动我的 Apache 服务器时,它没有启动并抛出一个错误:

<块引用>

错误:Apache 意外关闭。

15:00:12  [Apache]  This may be due to a blocked port, missing dependencies, 
15:00:12  [Apache]  improper privileges, a crash, or a shutdown by another method.
15:00:12  [Apache]  Press the Logs button to view error logs and check
15:00:12  [Apache]  the Windows Event Viewer for more clues
15:00:12  [Apache]  If you need more help, copy and post this
15:00:12  [Apache]  entire log window on the forums

我应该继续使用 XAMPP 还是使用 nginx 来设置反向代理?

0 个答案:

没有答案
相关问题