那是我第一次在我的计算机中为本地工作和测试配置虚拟主机。我正在尝试访问我在可用站点/默认站点上配置的 blog.dev,但它不起作用。这是我的网站可用/默认:
<VirtualHost *:80>
ServerAdmin eduguimara@gmail.com
ServerName blog.dev
ServerAlias www.blog.dev
DocumentRoot /var/www/crud/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/crud/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
我做了 sudo a2ensite blog.dev.conf 和 sudo service apache2 restart 。根据我找到的指南、帮助和教程,它应该正在运行。但是我的浏览器找不到http://blog.dev。
当我键入 localhost 时,它仍然可以工作,但 ServerName 不工作。Ports.conf 上的 NameVirtualHost *:80 可以。
我尝试在 sites-available/ 目录中配置一个名为 blog.dev.conf 的新文件,但它仍然无法正常工作。