dongwolu5275 2016-07-15 23:02
浏览 35
已采纳

CakePHP连接在浏览器中被拒绝

I'm working on setting up/learning CakePHP for the first time and I am struggling to figure out why I cannot reach my server over the default port 8765. I like to develop on an ubuntu machine and work on the code remotely. The server is hosted on a vm on my local machine, but i am referring to it as the remote machine. Both the server and my remote machine are on the same 10.0.1.x subnet. I can reach the server over port 80 fine. However, when I attempt to reach hxxp://10.0.1.44:8765/ I get the following message

Failed to connect to 10.0.1.44 port 8765: Connection refused

I've tried disabling my firewall on the Ubuntu 16 server by doing sudo uff disable and that didn't work. I've also tried editing my Apache2.conf file and overriding the directory permissions. These are my current global permissions:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Any help is greatly appreciated!

  • 写回答

1条回答 默认 最新

  • douxie3625 2016-07-17 13:58
    关注

    develop on an ubuntu machine and work on the code remotely

    The problem you likely have is that php's built-in web server (which CakePHP's server shell uses) does not bind to all ip addresses - it only binds to the ip and host name you start it on.

    To have the server listen to all ip addresses and respond however it's accessed, use '0.0.0.0' as the hostname:

    -> bin/cake server -H 0.0.0.0
    
    Welcome to CakePHP v3.1.3 Console
    ---------------------------------------------------------------
    App : src
    Path: /var/www/cakephp.dev/src/
    DocumentRoot: /var/www/cakephp.dev/webroot
    ---------------------------------------------------------------
    built-in server is running in http://0.0.0.0:8765/
    You can exit with `CTRL-C`
    

    Note that if you're using the development server - apache config is irrelevant as apache is playing no role in serving requests.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?