Apache2 无法识别第三方源的设置

Apache2 无法识别第三方源的设置

我有 apache2 为 2 个 conf 文件工作,但无法让它为第三个工作。文件名为foxclone.conftest.conf和,test2.conf位于 sites-available 文件夹中。test2 是不起作用的 conf。我已将 test2 添加到/etc/hosts文件。我的测试2.conf复制自测试配置文件以及对路径所做的更改。当我打开浏览器http://测试2,我得到的是 Apache Ubuntu 默认页面,而不是索引.html在里面公共的html子文件夹。

test2.conf如下:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # 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 test

    ServerAdmin webmaster@localhost
DocumentRoot /home/larry/web/test2/public_html/
<Directory /home/larry/web/test2/public_html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</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}/error.log
    CustomLog ${APACHE_LOG_DIR}/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

Hosts文件如下:

127.0.0.1   localhost
127.0.1.1   larry-dev2
127.0.0.1   test
127.0.0.1   test2
127.0.0.1   foxclone

# 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

有人可以帮我解决这个问题吗?

提前致谢。

编辑:忘了提及我已经重新启动了 apache。

答案1

通过在终端中使用“sudo nano /etc/apache2/sites-available/test2.conf”编辑 test2.conf 使其正常工作。

相关内容