【问题标题】:Ngrok forwarding fails when the index of the directory is a *.php file当目录的索引是 *.php 文件时,Ngrok 转发失败
【发布时间】:2016-10-03 08:00:04
【问题描述】:

我想让 ngrok 在我的本地服务器上使用 php 脚本,但在加载后出现 502 错误:

502 错误网关 服务器返回无效或不完整的响应。

我已经完成了以下操作 - 在我的 /etc/hosts 中有一行

127.0.0.1   test.dev

此外,为该本地域启用了一个虚拟主机:

cat /etc/apache2/sites-enabled/test.conf

<VirtualHost *:80>
    ServerName test.dev
    DocumentRoot /var/www/test
    ErrorLog ${APACHE_LOG_DIR}/error-test.log
    CustomLog ${APACHE_LOG_DIR}/access-test.log combined
</VirtualHost>

当我将 index.html 文件放入我的 /var/www/test 目录运行时

ngrok http -host-header=rewrite test.dev:80

完美运行!

但是,如果我将 index.html 重命名为 index.php,则会出现上面的加载错误。

我在 Ubuntu 14.04 上使用 ngrok 版本 2.0.25。

我做错了什么?

【问题讨论】:

  • 您介意将您的解决方案移至答案吗?这将有助于表明这个问题确实有解决方案。
  • @peter 我已将其作为社区答案。

标签: php xdebug ngrok


【解决方案1】:

OP 在问题描述中写道:

好的,问题来自启用了以下设置:

xdebug.remote_connect_back=1

在注释掉它之后,ngrok 也开始为 *.php 文件工作。

【讨论】:

    【解决方案2】:

    这就是我解决我的问题的方法。 我浏览到包含我的应用程序的目录(index.php 所在的位置),然后使用 cmd 启动服务器: php -S localhost:4040 之后,我执行了 ngrok.exe 文件并运行命令: ngrok http 4040 这解决了我的问题。

    【讨论】:

      猜你喜欢
      • 2019-05-23
      • 1970-01-01
      • 2011-06-18
      • 2015-06-15
      • 1970-01-01
      • 2014-08-22
      • 1970-01-01
      • 2015-08-12
      • 1970-01-01
      相关资源
      最近更新 更多