我试图让网站正常工作没有“www”加法。
www.roeldevries.me工作正常,但roeldevries.me给出了另一个结果。
有人能帮我吗?
/ etc / apache2 / sites-available roeldevries.me config:
<VirtualHost *:80> ServerName roeldevries.me ServerAlias www.roeldevries.me DocumentRoot /var/www/roeldevries.me/public_html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/roeldevries.me/public_html> Options Indexes FollowSymLinks MultiViews AllowOverride None 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 ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.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> </VirtualHost>
/ etc / hostsconfiguration
127.0.1.1 localhost 127.0.1.1 roeldevries.me www.roeldevries.me ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
a2ensite roeldevries.me apachectl -t apachectl restart 如果apachectl -t错误,发布它们。
也显示启用了ls /etc/apache2/sites-enabled/ ,禁用a2dissite任何额外的站点未被使用。
就我个人而言,我并不像我的真实域那样为我的根域使用相同的IP,例如。
jacobdevans.com IN A 198.251.86.133 ; 任播301
www.jacobdevans.com IN NS coco.ns.cloudflare.com. www.jacobdevans.com IN NS guy.ns.cloudflare.com.
绝对不需要在hosts文件中指定域为127.0.0.1或127.0.1.1 – 将其删除并使用ServerName localhost.localdomain 。 你有VirtualHost *:80 – 这就够了。
这必须工作,并将工作。 只有理由不会成为网站的configuration,这可能会看你正在访问的域名。 这是唯一可能的事情。