ubuntu 18.04中的Lumen虚拟主机

ubuntu 18.04中的Lumen虚拟主机,ubuntu,virtualhost,virtual,lumen,host,Ubuntu,Virtualhost,Virtual,Lumen,Host,我已经为一个laravel项目实现了一个虚拟主机,并且工作没有任何问题,在实现所有东西时也没有任何问题 现在我正在为我的lumen项目做同样的事情,但它不起作用: 嗯。我们找不到那个网站。 下面是我的test.local.conf的外观: <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port t> # the server uses to

我已经为一个laravel项目实现了一个虚拟主机,并且工作没有任何问题,在实现所有东西时也没有任何问题

现在我正在为我的lumen项目做同样的事情,但它不起作用:
嗯。我们找不到那个网站。

下面是我的test.local.conf的外观:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port t>
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin admin@test.com
    ServerAlias test.local
    ServerName test.local
    DocumentRoot /var/www/html/test/public

    <Directory /var/www/html/test/public>
            Options -Indexes +FollowSymLinks
            AllowOverride All
            Allow from all
    </Directory>
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/test.local-error.log
    CustomLog ${APACHE_LOG_DIR}/test.local-access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

#ServerName指令设置请求方案、主机名和端口t>
#服务器使用来标识自身。这在创建时使用
#重定向URL。在虚拟主机的上下文中,服务器名
#指定必须在请求的主机:标头中显示的主机名
#匹配此虚拟主机。对于默认虚拟主机(此文件),此
#该值不是决定性的,因为它被用作最后的宿主。
#但是,必须为任何其他虚拟主机显式设置它。
#服务器名www.example.com
服务器管理员admin@test.com
ServerAlias test.local
ServerName test.local
DocumentRoot/var/www/html/test/public
选项-索引+FollowSymLinks
允许超越所有
通融
#可用日志级别:trace8、…、trace1、调试、信息、通知、警告、,
#错误、暴击、警报、紧急情况。
#还可以为特定应用程序配置日志级别
#模块,例如。
#日志级别信息ssl:警告
ErrorLog${APACHE_LOG_DIR}/test.local-error.LOG
CustomLog${APACHE_LOG_DIR}/test.local-access.LOG组合
#对于conf/available/中的大多数配置文件
#在全局级别启用或禁用,可以
#仅包含一个特定虚拟主机的行。例如
#以下行仅为此主机启用CGI配置
#在使用“A2F”全局禁用后。
#包括conf available/service-cgi-bin.conf
#vim:syntax=apachets=4sw=4sts=4srnoet

我已经重新启动了apache,但它不工作。我做错了什么?

在stavkoverflow的三个问题中,我都回答了自己

无论如何,没有任何问题,所有正在努力解决此问题的人都不要忘记向机器主机文件添加一个条目,如下所示:

sudo nano /etc/hosts
添加此行:

127.0.0.1       test.local
ctrl+o
保存,并
ctrl+x
退出

最后一步,只需重新启动apache:
sudo服务apache2 restart

PS:如果已使用
127.0.0.1
,则可以设置另一个ip,如:
127.0.0.2

工作起来很有魅力