Virtualbox PhpStorm web服务器调试验证的问题

Virtualbox PhpStorm web服务器调试验证的问题,virtualbox,magento2,xdebug,remote-debugging,phpstorm-2018.2,Virtualbox,Magento2,Xdebug,Remote Debugging,Phpstorm 2018.2,在PhpStorm中,我试图调试远程服务器上的代码。Web服务器调试验证不断告诉我无法访问指定的url(404) 我的主机在windows下 我的服务器位于VirtualBox虚拟机(Debian 9)上 我在网络驱动器V:上使用PhpStorm编辑代码,指向虚拟机的/var/www/文件夹。这不是VirtualBox共享文件夹(Debian 9不支持)。 因此,当我处理V:\myproject时,我实际上是通过smb在VM上处理/var/www/myproject 我学习了很多教程,但都没有成

在PhpStorm中,我试图调试远程服务器上的代码。Web服务器调试验证不断告诉我无法访问指定的url(404)

我的主机在windows下

我的服务器位于VirtualBox虚拟机(Debian 9)上

我在网络驱动器
V:
上使用PhpStorm编辑代码,指向虚拟机的
/var/www/
文件夹。这不是VirtualBox共享文件夹(Debian 9不支持)。 因此,当我处理
V:\myproject
时,我实际上是通过smb在VM上处理
/var/www/myproject

我学习了很多教程,但都没有成功。目前,我有以下配置:

  • PHP Cli远程解释器,使用部署配置
  • 所述部署配置的连接类型为SFTP(连接测试正常)。根路径是
    /var/www/myproject
    。Web服务器url为
    https://my.project.local
    (url已在我的浏览器中测试)
  • 映射本地路径:
    V:\myproject
  • 映射部署路径:
    /
  • 映射web路径:
    /pub
    (此项目是Magento 2应用程序。pub是web根目录)
当我尝试验证web服务器调试时,我选择“远程web服务器”,创建验证脚本的路径是
V:\myproject\pub
,部署服务器是前面描述的部署配置

验证失败,说明“指定的URL无法访问,原因是:'请求失败,状态代码404'”

是否有人已通过此特定设置?(PhpStorm+VirtualBox VM+SFTP连接上的远程调试)。你成功了吗?
也许我应该尝试另一种方法来让它工作?非常感谢您的帮助

有点晚了,但是如果有人遇到这个问题,并且碰巧在Nginx上运行Magento 2,请查看Nginx.conf.sample,或者您正在使用的任何ngxin.conf

找到下面的块:

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;
    fastcgi_buffers 1024 4k;

    fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
    fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
这样修改它,允许Nginx提供验证脚本:

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|_intellij_phpdebug_validator)\.php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;
    fastcgi_buffers 1024 4k;

    fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
    fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

这很有效。如果在进行这些更改后它不起作用。检查“创建验证脚本的路径”所使用的路径:对于mac,该路径应指向$MAGE_ROOT/pub,如果是/usr/local/var/www/pub。(假设您的magento安装在/usr/local/var/www内)。对于ubuntu,它应该是/var/www/html/pub。