1,首先打開PHPStudy服務器窗口 顯示啟動成功即可
2,點擊 “其他選項菜單” --------》打開配置文件------》vhosts-conf 點開
3,然后添加你的域名信息 填完保存關閉
<VirtualHost *:80>
DocumentRoot "D:\study\test" //目標文件夾
ServerName www.study.cn //你的域名
ServerAlias www.study.cn //你的域名
<Directory "D:\PHPlhj\test">//目標文件夾
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>上邊的比較簡單也可嘗試操作下面這個
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.study.com //你的域名
DocumentRoot "d:/PHPStudy/http/" //目標文件夾
<Directory "d:/phplhj/http/"> //目標文件夾
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
AllowOverride Options FileInfo
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
4,點擊 “其他選項菜單” --------》打開配置文件------》http-conf 點開
5,之后點擊ctar+F搜索一下 vhosts 刪除前面的#
6,然后按照路徑在電腦找到hosus文件 然后打開
7,把你的域名寫上去即可、
域名按照格式寫入然后保存關閉
重啟PHPStudy即可
注意:若無法對hosts文件進行修改,請右擊hosts,選擇屬性,安全,把所有用戶的權限都勾選即可修改。