2

我想让 ngrok 在我的本地服务器上使用 php 脚本,但是在加载一些之后我得到一个 502 错误:

502 Bad Gateway 服务器返回无效或不完整的响应。

我已经完成了以下操作 - 在我的 /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>

当我在运行的 /var/www/test 目录中只放一个 index.html 文件时

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

完美运行!

但是,如果我将 index.html 重命名为 index.php,我会在上面收到此加载错误。

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

我究竟做错了什么?

4

2 回答 2

0

OP在问题描述中写道:

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

xdebug.remote_connect_back=1

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

于 2018-04-10T15:20:53.797 回答
0

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

于 2021-09-24T19:46:59.623 回答