Laravel无法在localhost上显示Apache默认页面。虚拟主机更改失败

时间:2016-06-21 19:23:45

标签: php apache laravel docker virtualhost

我必须制作LAravel应用程序并提供Dockerfile,但我真的坚持这一点。在此之前,我曾在我的机器上安装laravel噩梦。

我试图获得dockervel图像,并且我按照这里的步骤进行操作:http://www.spiralout.eu/2015/12/dockervel-laravel-development.html

我之前有问题并进行了更改:Error starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use

一切顺利

  

修复权限: dpermit 现在您已启用注册系统。的转到   到localhost 并注册一个新用户以查看数据库运行正常。

当我去localhost时,我得到:Apache2 Ubuntu默认页面 https://assets.digitalocean.com/articles/lamp_1404/default_apache.png

我抓住了这个:我跑的时候

$ dcomposer-create
It gets to the end but I get this 
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
Installing laravel/laravel (v5.2.31)
  - Installing laravel/laravel (v5.2.31)
    Downloading: 100%         

Created project in /var/www
> php -r "copy('.env.example', '.env');"

Shoud我继续安装或首先解决这个问题?

alredy var / www / laravel (在本地laravel环境中)的laravel项目。 我的etc / hosts文件看起来像:

127.0.0.1   laravel.example.com
127.0.1.1   me-Lenovo-Z50-75

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1  laravel.example.com

$ dcomposer-create dockervel / www / 中创建应用程序。

我现在更改了/ etc / apache2 / sites-available

中的 dockervel.example.com.conf
<VirtualHost *:80>

        ServerName dockervel.example.com
        DocumentRoot /home/me/Desktop/dockerlaravel/dockervel/www/public
        DirectoryIndex index.php

        <Directory /home/me/Desktop/dockerlaravel/dockervel/www>
                Options FollowSymLinks
                AllowOverride None
        </Directory >
        <Directory >
                AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

并更改了/ etc / hosts

127.0.0.1  dockervel.example.com
127.0.1.1   me-Lenovo-Z50-75

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1  dockervel.example.com

我也跑:

$ a2ensite dockervel.example.com
$ sudo service apache2 reload

当我跑步时:

apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost dockervel.example.com (/etc/apache2/sites-enabled/dockervel.example.com.conf:1)
         port 80 namevhost laravel.example.com (/etc/apache2/sites-enabled/laravel.example.com.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

当我继续安装时

$ dnodejs nmp install - this is ok 
$ dnodejs gulp install
[17:40:09] Using gulpfile /var/www/gulpfile.js
[17:40:09] Task 'install' is not in your gulpfile
[17:40:09] Please check the documentation for proper gulpfile formatting

如您所见,所有都在/ var / www ,但我希望它在我的工作目录 / home / me / Desktop / dockerlaravel / dockervel

我看不出问题出在哪里?

1 个答案:

答案 0 :(得分:0)

由于您已将端口更改为“8084”,因此应转至localhost:8084 如果您看到apache默认,那么您可能正在浏览另一台服务器,因为dockervel是基于nginx构建的 你也可能在Docker上有一些差距。不要将本地存储与docker存储混合在一起。容器中的/ var / www与本地/ var / www不同。在docker-compose.yml中,您将本地〜/ dockervel / www挂载到containers / var / www 我建议您重新开始,并将您对Apache服务器所做的更改还原。关闭它,你不需要它。 Dockervel将在容器中为您提供NginX服务器。