現(xiàn)在有多個(gè)網(wǎng)站需要在Linux服務(wù)器上配置,選擇了phpstudy,下面介紹多站點(diǎn)的配置方法:
phpstudy add | del | list 添加虛擬主機(jī) | 刪除虛擬主機(jī) | 查看虛擬主機(jī)列表
[root@VM_128_12_centos ~]# phpstudy add (Please input domains such as:www.phpstudy.net):www.linuxsight.comSuccessfully create www.linuxsight.com vhost ################### information about your website ###################### The DocumentRoot:/phpstudy/www/www.linuxsight.com
phpstudy會默認(rèn)在/phpstudy/www/建立目錄,但有時(shí)候我們并不想放在這里,我們想映射到其它地方。方法如下:
找到 /phpstudy/server/httpd/conf/vhosts 目錄下
www.linuxsight.com.conf 文件 修改紅色區(qū)域,改為你想要的路徑
如下:(因?yàn)槲野蚜硪粋€(gè)硬盤分區(qū)掛載到了web目錄下,這樣即便重裝數(shù)據(jù)也在)
<virtualhost *:80>
ServerName www.linuxsight.com
ServerAlias www.linuxsight.com
DocumentRoot /phpstudy/www/web/www.linuxsight.com
DirectoryIndex index.php index.html
<Directory /phpstudy/www/web/www.linuxsight.com>
Options +Includes +FollowSymLinks -Indexes
AllowOverride All
Order Deny,Allow
Allow from All
</Directory>
</virtualhost>
用同樣的方法可以建立其它站點(diǎn),二級域名也一樣。