我已经使用Ubuntu 18.04在VPS上建立了一个网站。我只安装了Apache和PHP,并将ufw配置为允许通过80和443端口进行访问。
在我的注册商处,由于这实际上是服务器的主要站点,因此我添加了DNS的服务器ip:192.188.78.105,还将名称服务器修改为ns1.justfitnessbooks.com和ns2.justfitnessbooks.com
FYI,ns1.xx和ns2.xxx可以正常工作,因为在此安装之前,我已经安装了Vesta CP,该软件安装了完整的服务器程序包,站点可以正常加载,但是无法在Vesta CP中使用电子邮件,所以我卸载了所有内容并开始进行手动配置。
/ etc / apache2 / sites-available中的我的justfitnessbooks.com.conf文件如下:
<VirtualHost *:80>
ServerAdmin myemail@myserver.com
ServerName justfitnessbooks.com
ServerAlias www.justfitnessbooks.com
DocumentRoot /var/www/html/justfitnessbooks.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/ etc / apache2 / sites-enabled中的我的justfitnessbooks.com.conf文件如下:
<VirtualHost *:80>
ServerAdmin myemail@myserver.com
ServerName justfitnessbooks.com
ServerAlias www.justfitnessbooks.com
DocumentRoot /var/www/html/justfitnessbooks.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我的/ etc / hosts文件如下:
192.188.78.105 justfitnessbooks.com
192.188.78.105 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
#::1 justfitnessbooks.com
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
对站点目录执行ls -la权限看起来像这样:
admin@server-12345:/var/www/html$ ls -la
total 24
drwxr-xr-x 3 root root 4096 Mar 8 15:39 .
drwxr-xr-x 3 root root 4096 Mar 8 01:53 ..
-rwxr-xr-x 1 root root 10918 Mar 8 01:53 index.html
drwxr-xr-x 3 root root 4096 Mar 8 15:39 justfitnessbooks.com
admin@server-12345:/var/www/html$
我已使用systemctl restart apache2重新启动了Apache
而且,当我检查主机的justfitnessbooks.com时,会收到以下消息:
admin@server-12345:~$ host justfitnessbooks.com
justfitnessbooks.com has address 192.188.78.105
Host justfitnessbooks.com not found: 2(SERVFAIL)
admin@server-12345:~$
我想念什么? 我要在服务器上修改与ns1.xxx ns2.xxx相关的任何内容吗?
有什么建议吗?