Apache2虚拟主机失败,名称或服务未知

时间:2018-06-01 00:46:24

标签: apache virtualhost

从Ubuntu 17.10迁移到Mint 18.3并迁移虚拟主机配置文件失败

[core:error] [pid 3012] (EAI 2)Name or service not known: AH00547: Could not resolve host name

在我刚安装好的Mint上,我已经完成了这个 1)sudo a2dissite 000-default.conf

这是我用于Vhosts的标准配置文件

<VirtualHost *.domain.localhost:80>
    ServerName domain.localhost
    ServerAlias www.domain.localhost api.domain.localhost
    ServerAdmin webmaster@localhost
    DocumentRoot /home/dev/projects/domain/web/html/
    <Directory /home/dev/projects/domain/web/html/>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    CustomLog /var/log/apache2/access.log combined
    ServerSignature Off
</VirtualHost>

BTW:这个步骤我为每个项目做了一件事 1)sudo chown -R www-data:www-data PATH_TO_DIR
2)sudo chmod 660 -R PATH_TO_DIR
3)sudo chmod -R -x + X PATH_TO_DIR
4)sudo找到PATH_TO_DIR -type d -exec chmod g + s {} \;
5)sudo setfacl -R -d -m u :: rwX,g :: rwX,o :: - PATH_TO_DIR

更新: 将域添加到/ etc / hosts,再次将服务器引导重新加载到默认值

1 个答案:

答案 0 :(得分:0)

我通过修改&#34; 000-default.conf&#34;解决了这个问题。 DocumentRoot Path,然后修改&#34; /etc/apache2/apache2.conf"通过添加这些行

<Directory /home/mdev/_projects/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

这也必须从

改变
<VirtualHost *.domain.localhost:80>

<VirtualHost *:80>

/ etc / hosts neccassary没有条目!