简体   繁体   English

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

[英]Laravel not working showing Apache default page on localhost. Virtual Host changes failed

I have to make LAravel app and to deliver a Dockerfile ,but i'm realy stuck with this. 我必须制作LAravel应用程序并提供Dockerfile,但我确实对此感到困惑。 Before that I had a nightmare wile installing laravel on my machine. 在那之前,我做了个噩梦,在机器上安装了laravel。

I'm trying to get dockervel image and I'm following the steps here: http://www.spiralout.eu/2015/12/dockervel-laravel-development.html 我正在尝试获取dockervel映像,并且正在执行以下步骤: http : //www.spiralout.eu/2015/12/dockervel-laravel-development.html

I had problems before and made changes : Error starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use 我之前遇到问题并进行了更改: 启动userland代理时出错:侦听tcp0.0.0.0:3306:绑定:地址已在使用中

All good till the step 一切顺利

fix permissions: dpermit Now you have a registration system active. 修复权限: dpermit现在您已激活注册系统。 Go to localhost and register a new user to see that db's are running ok. 转到localhost并注册一个新用户,以查看数据库是否运行正常。

When I go to localhost I get : Apache2 Ubuntu Default Page https://assets.digitalocean.com/articles/lamp_1404/default_apache.png 当我转到本地主机时,我得到:Apache2 Ubuntu默认页面https://assets.digitalocean.com/articles/lamp_1404/default_apache.png

I have catched this : when I run 我已经抓住了:我跑步时

$ 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 I move on eith installation or first fix this? 应该我继续安装还是先解决这个问题?

I alredy have a laravel project in var/www/laravel (on local laravel environment). 我确实在var / www / laravel中 一个laravel项目(在本地laravel环境中)。 And my etc/hosts file looks like : 我的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

And $ dcomposer-create creates application in dockervel/www/ . $ dcomposer-createdockervel / www /中创建应用程序。

I have changeg now made dockervel.example.com.conf in /etc/apache2/sites-available 我现在已经更改了/ 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>

And changed /etc/hosts 并更改了/ 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

I also run: 我也跑:

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

And When I run : 当我跑步时:

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

And when I continue with the instalation 当我继续安装时

$ 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

As you can see ,All goes in /var/www but I want it to be in my working directory /home/me/Desktop/dockerlaravel/dockervel . 如您所见,所有内容都在/ var / www中,但我希望它位于我的工作目录/ home / me / Desktop / dockerlaravel / dockervel中

I can not see what is the problem is the problem? 我看不出问题是什么问题?

Since you have changed the port to "8084" you should go to localhost:8084 If you see the apache default then you probably are browsing another server since dockervel is build upon nginx. 由于您已将端口更改为“ 8084”,因此应转到localhost:8084。如果看到apache默认值,则可能是在浏览另一台服务器,因为dockervel是基于nginx构建的。
You have also probably have some gaps on Docker. 您可能在Docker上也有一些空白。 Don't mix your local storage with docker storage. 不要将本地存储与docker存储混合使用。 /var/www in a container is different than your local /var/www. 容器中的/ var / www与本地/ var / www不同。 in docker-compose.yml you mount the local ~/dockervel/www to containers /var/www. 在docker-compose.yml中,您将本地〜/ dockervel / www安装到容器/ var / www。
I would suggest that you start all over again and revert the changes you've made to your apache server. 我建议您重新开始并还原对apache服务器所做的更改。 Shut it down, you don't need it. 关闭它,您不需要它。 Dockervel will provide you with an NginX server in a container. Dockervel将在容器中为您提供NginX服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM