ssh登录服务器,在plesk的框架下,修改服务器v-host.conf配置文件
1.增加配置文件v-host.conf,内容如下
<pre class="brush:plain;"> ServerAlias *.domain.com
```
<p>
2.通知plesk,读取新的v-host配置文件,命令</p>
<pre class="brush:bash;"> /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com
```
<p>
3.重启apache服务器,命令</p>
<pre class="brush:bash;"> /sbin/service httpd restart
```
<p>
</p>
<p>
参考:</p>
<p>
This tutorial describes how to setup a wildcard DNS record in Plesk 8 using Bind and Apache. This allows you to use *.domain.com to access your www.domain.com (http://www.domain.com) website. For example, any of the following would be automatically redirected to www.domain.com (http://www.domain.com)</p>
<div>
</div>
<div>
test.domain.com</div>
<div>
john.domain.com</div>
<div>
jane.domain.com</div>
<div>
bugs.domain.com</div>
<div>
</div>
<div>
</div>
<div>
Let's get started!</div>
<div>
</div>
<div>
1. Configure Plesk/Bind DNS</div>
<div>
</div>
<div>
Add a wildcard CNAME record to DNS in Plesk by going to DOMAINS>click the domain you want to configure here>DNS. Add a new record</div>
<div>
</div>
<div>
Record type: CNAME</div>
<div>
Enter domain name: *.domain.com</div>
<div>
Enter a canonical name: domain.com</div>
<div>
</div>
<div>
So you should have a new record that looks something like this</div>
<div>
</div>
<div>
*.domain.com. CNAME domain.com.</div>
<div>
</div>
<div>
2. Configure Apache</div>
<div>
</div>
<div>
SSH to your server and edit the vhost.conf file (you may have to create it if you don't have one for your domain).</div>
<div>
</div>
<div>
# cd /var/www/vhosts/domain.com/conf</div>
<div>
# touch vhost.conf</div>
<div>
# vi vhost.conf</div>
<div>
Add this line to the file</div>
<div>
</div>
<div>
ServerAlias *.domain.com</div>
<div>
Save and close the vhost.conf file</div>
<div>
</div>
<div>
Now you must reconfigure the domain via Plesk to pick up the new vhost.conf changes (adds a line to the httpd.include file to look at the directives in the vhost.conf). You can't edit the httpd.include file directly as it's overwritten by Plesk all the time. You must make your custom changes to the vhost.conf file.</div>
<div>
</div>
<div>
</div>
<div>
# /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com</div>
<div>
</div>
<div>
Restart the httpd service and thats it.</div>
<div>
</div>
<div>
</div>
<div>
# /sbin/service httpd restart</div>
plesk apache ssh 泛域名 Wildcard DNS