这是尝试实现目标的人员的总体配置(开发环境中的通配符,即XAMPP,此示例假定所有站点都指向相同的代码库)
主机文件(添加条目)
文件:%SystemRoot%\ system32 \ drivers \ etc \ hosts
127.0.0.1 example.local
httpd.conf配置(启用虚拟主机)
档案:\ XAMPP \ etc \ httpd.conf
# Virtual hosts
Include etc\extra\httpd-vhosts.conf
httpd-vhosts.conf配置
文件:XAMPP \ etc \ extra \ httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin admin@example.local
DocumentRoot "\path_to_XAMPP\htdocs"
ServerName example.local
ServerAlias *.example.local
# SetEnv APP_ENVIRONMENT development
# ErrorLog "logs\example.local-error_log"
# CustomLog "logs\example.local-access_log" common
</VirtualHost>
重新启动Apache
创建pac文件:
另存为what.pac,然后在浏览器的网络>代理>自动配置设置中加载文件(如果更改此设置,则重新加载)
function FindProxyForURL(url, host) {
if (shExpMatch(host, "*example.local")) {
return "PROXY example.local";
}
return "DIRECT";
}