apache - 如何在 Windows 中使用 XAMPP 设置反向代理服务器
问题描述
我正在尝试在 XAMPP 中设置反向代理服务器,以避免当我尝试访问在不同端口上运行的 API 时发生的 CORS 错误。我已经对我的文件进行了这些更改。
API 的详细信息如下:
- 主机=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 来设置反向代理?
解决方案
推荐阅读
- javascript - 基于数组的 React 组件映射
- shopify - 使用 Shopify 液体同时将 3 个产品添加到购物车
- c++ - read() 永远不会完成从 curl 请求中的读取
- kubernetes - 基于 Kubernetes 客户端证书的身份验证导致使用 system:anonymous 用户的请求
- jenkins - 矩阵组合过滤器与参数化触发插件相结合
- bash - 带有 `bash` 和 `source` 的 bash 陷阱
- scheme - 从消息传递运行定义
- flutter - 颤动闪屏状态栏颜色闪烁
- memory - 如何使用 ffmpeg 连接非常大的视频
- excel - VBA_让粘贴的下标超出范围无法找出错误