Ubuntu 在Apache中创建子域

Ubuntu 在Apache中创建子域,ubuntu,dns,apache2,virtualhost,subdomain,Ubuntu,Dns,Apache2,Virtualhost,Subdomain,因此,我在apache2/sites中的默认文件可用 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/leaguenotes ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 我想有一个子域名cms.leagueno

因此,我在apache2/sites中的默认文件可用

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/leaguenotes
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我想有一个子域名cms.leaguenotes.com,它将明确指向我的cms文件夹,这是我的cms.leaguenotes.com.conf文件

<VirtualHost *:80>
ServerName cms.leaguenotes.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/cms.leaguenotes
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
然后我还重新启动了sudo a2ensite cms.leaguenotes.com和服务apache2,不幸的是,当我转到cms.leaguenotes.com时,没有显示任何内容。我添加了文件夹并添加了索引,示例如下:步骤1:运行apachectl configtest并确保没有错误。如果有问题,请修复它们,然后重复

步骤2:确保您的域指向正确的DNS服务器。Ping并检查返回的IP是否正确。您可能需要等待添加的子域进行DNS传播


步骤3:查看错误日志以获取提示。

您是否有名称VirtualHost*:80?