Lumen虚拟主机在ubuntu 18.04



我已经为一个laravel项目实现了一个虚拟主机,工作起来没有任何问题,在实现所有东西方面也没有任何问题。

现在我也在为我的流明项目做同样的事情,但它不起作用:Hmm. We’re having trouble finding that site.

这就是我的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

我已经重新启动了apache,但它不起作用。我在这里做错了什么?

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

不管怎样,没问题,每个正在为此而挣扎的人都不要忘记在机器主机文件中添加一个条目,如下所示:

sudo nano /etc/hosts

添加此行:

127.0.0.1       test.local

ctrl+o保存,ctrl+x退出

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

PS:如果127.0.0.1已经被占用,您可以设置另一个ip,如:127.0.0.2

工作起来很有魅力!

相关内容

  • 没有找到相关文章

最新更新