XAMPP - ERR_CONNECTION_REFUSED

时间:2017-10-05 15:13:28

标签: php apache rest xampp slim

对于一个学校项目,我需要创建一个REST-API(我为PHP选择了Slim Framework)

我遵循了这个教程 - > https://youtu.be/TcFUNG7M3VE

在本教程中,他想在XAMPP中创建一个虚拟主机

刚开始我使用Composer下载了slim Framework,之后我从https://www.slimframework.com/

复制了示例

现在我想通过虚拟主机访问网站:

  1. 我创建了一个.htaccess文件
  2. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L]

    1. 然后我修改了xampp \ apache \ conf \ extra中的httpd-vhost.conf文件
    2. 我添加了这些代码片段:

      NameVirtualHost *:81

      <VirtualHost *:81> DocumentRoot "C:/xampp/htdocs/" ServerName localhost </VirtualHost>

      <VirtualHost *:81> DocumentRoot "C:/xampp/htdocs/myslimsite/public" ServerName myslimsite </VirtualHost>

      1. 我在“C:\ Windows \ System32 \ drivers \ etc”中的“hosts”文件中写了这个 127.0.0.1 localhost 127.0.0.1 myslimsite 255.255.255.255 broadcasthost ::1 localhost
      2. 当我想访问myslimlite而不是localhost时,我得到这个ERR_CONNECTION_REFUSED错误

        这是在错误日志中: AH00548: NameVirtualHost has no effect and will be removed in the next release C:/xampp/apache/conf/extra/httpd-vhosts.conf:22 [Thu Oct 05 16:41:13.623467 2017] [ssl:warn] [pid 8424:tid 236] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name

        httpd-vhost.conf的第22行是NameVirtualHost *:81

        所以我猜httpd-ssl.conf或httpd-vhost.conf文件有问题?

        或者我做错了什么?

        仅为了您的信息,这是我在这样的论坛中的第一篇文章,请告诉我,如果我做错了,以便下次我能做得更好。

0 个答案:

没有答案