微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

我正在尝试在 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 来设置反向代理?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。