Linux版phpstudy配置多域名站点自定义路径

2017年04月07日 PHP 暂无评论

现在有多个网站需要在Linux服务器上配置,选择了phpstudy,下面介绍多站点的配置方法:

phpstudy add | del | list                    添加虚拟主机 | 删除虚拟主机 | 查看虚拟主机列表

[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会默认在/phpstudy/www/建立目录,但有时候我们并不想放在这里,我们想映射到其它地方。

方法如下:找到 /phpstudy/server/httpd/conf/vhosts 目录下www.linuxsight.com.conf  文件  修改红色区域,改为你想要的路径如下:(因为我把另一个硬盘分区挂载到了web目录下,这样即便重装数据也在)

<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 -IndexesAllowOverride AllOrder Deny,AllowAllow from All

</Directory>

</virtualhost>

用同样的方法可以建立其它站点,二级域名也一样。

给我留言