添加一个子域到我的Debian服务器

我创build了一个ndd的子域,我用Aredirect到我的服务器

在我的服务器上,我创build了一个Apache文件,将该子域redirect到正确的目录。 这里是configuration文件 – 位于/ etc / apache2 / sites-avalaible / vietnam /

<VirtualHost*:80> DocumentRoot /var/wwwvietnam.mysite.net <Directory /var/www/vietnam.mysite.net/> 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 ${APACHE_LOG_DIR}/vietnam_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/vietnam_access.log combined </VirtualHost> 

然后我添加了configuration

 a2ensite vietnam 

我用这样的子域名更改/ etc / hosts

 11.22.33.44 vietnam.mysite.net 

事情是,当我打开我的浏览器vietnam.mysite.net它显示index.html位于/ var / www目录(即默认文件)它看起来像Apache不明白的conf …

有小费吗 。

您在虚拟主机设置中缺less一些configuration。

正如在Apache 文档中所解释的那样,您需要为您命名的虚拟主机指定以下选项:

 ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain 

ServerAlias是可选的,但通常你会想要使用它。

在你的情况下,你需要指定:

 ServerName vietnam.mysite.net DocumentRoot /var/www/vietnam.mysite.net