作为默认 apache2 页面出现。这些是我当前的配置。
sites-available
文件:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName chefceric.com
ServerAlias www.chefceric.com
DocumentRoot /var/www/ceric/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/ceric/>
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 None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error-chefceric.com.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access-chefceric.com.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
和:
a2ensite chefceric.com
该网站使用带有路径的直接链接出现。但由于某种原因,使用 DNS 时它不起作用,并且 DNS 上的 IP 地址是正确的,仍然是 apache 默认值。
我用的是a2dissite 000-default
答案1
看起来问题在于配置文件的名称错误。一定是这样,因为这些配置文件通过 中的下一个指令被纳入 Apache 的配置中:chefceric.com.conf
apache2.conf
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
因此,如果是这种情况,步骤应该是:
a2dissite chefceric.com
mv /etc/apache2/sites-available/chefceric.com /etc/apache2/sites-available/chefceric.com.conf
a2ensite chefceric.com.conf
systemctl restart apache2.service