apache - Apache2 虚拟主机失败,名称或服务未知
问题描述
从 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>
顺便说一句:我正在为每个项目执行此步骤
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 find PATH_TO_DIR -键入 d -exec chmod g+s {} \;
5) sudo setfacl -R -d -mu::rwX,g::rwX,o::- PATH_TO_DIR
更新:将域添加到 /etc/hosts,重新加载服务器再次导致默认值
解决方案
我已经通过修改“000-default.conf”DocumentRoot Path,然后通过添加这些行来修改“/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 没有必要的条目!
推荐阅读
- python - 将 win32client SAPI.SpVoice 与多线程一起使用会导致 pywintypes.com_error
- android - 我应该如何在 android 中维护会话以及我应该存储什么(散列密码或其他内容)以保持登录状态
- python - 插入数据以协调来自链接不同侧的读数的算法?
- javascript - 正则表达式 - 仅获取文本/数字和额外
- reactjs - 我可以使用默认操作弹出窗口更改 chrome 扩展的位置吗?
- dialog - AEM touch ui 对话框 6.3 - 验证错误图标重叠描述图标
- audio - 以长时间的静音录制流式音频
- openssl - 以编程方式将我的自签名证书添加到受信任的 CAS 列表中
- python - Python运行极慢一行代码
- docker - rm:无法删除“文件夹”:设备或资源繁忙 docker bind mount