Laravel 无法在本地主机上显示 Apache 默认页面。虚拟主机更改失败
Laravel not working showing Apache default page on localhost. Virtual Host changes failed
我必须制作 LAravel 应用程序并交付 Dockerfile,但我真的受困于此。在那之前,我在我的机器上安装 laravel 时做了一场噩梦。
我正在尝试获取 dockervel 图像,我正在按照此处的步骤操作:http://www.spiralout.eu/2015/12/dockervel-laravel-development.html
我之前遇到了问题并进行了更改:
一切顺利,直到这一步
fix permissions: dpermit Now you have a registration system active. Go
to localhost and register a new user to see that db's are running ok.
当我转到本地主机时,我得到: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');"
我应该继续安装还是先解决这个问题?
我已经在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.
我看不出是什么问题是什么问题?
由于您已将端口更改为“8084”,因此您应该转到 localhost:8084
如果您看到默认的 apache,那么您可能正在浏览另一台服务器,因为 dockervel 是基于 nginx 构建的。
您也可能在 Docker 上有一些差距。不要将本地存储与 docker 存储混用。容器中的 /var/www 与您本地的 /var/www 不同。在 docker-compose.yml 中,您将本地 ~/dockervel/www 挂载到容器 /var/www.
我建议您重新开始并恢复您对 Apache 服务器所做的更改。关闭它,你不需要它。 Dockervel 将在容器中为您提供 NginX 服务器。
我必须制作 LAravel 应用程序并交付 Dockerfile,但我真的受困于此。在那之前,我在我的机器上安装 laravel 时做了一场噩梦。
我正在尝试获取 dockervel 图像,我正在按照此处的步骤操作:http://www.spiralout.eu/2015/12/dockervel-laravel-development.html
我之前遇到了问题并进行了更改:
一切顺利,直到这一步
fix permissions: dpermit Now you have a registration system active. Go to localhost and register a new user to see that db's are running ok.
当我转到本地主机时,我得到: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');"
我应该继续安装还是先解决这个问题?
我已经在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.
我看不出是什么问题是什么问题?
由于您已将端口更改为“8084”,因此您应该转到 localhost:8084
如果您看到默认的 apache,那么您可能正在浏览另一台服务器,因为 dockervel 是基于 nginx 构建的。
您也可能在 Docker 上有一些差距。不要将本地存储与 docker 存储混用。容器中的 /var/www 与您本地的 /var/www 不同。在 docker-compose.yml 中,您将本地 ~/dockervel/www 挂载到容器 /var/www.
我建议您重新开始并恢复您对 Apache 服务器所做的更改。关闭它,你不需要它。 Dockervel 将在容器中为您提供 NginX 服务器。