Mac电脑设置本地pac文件及问题解决

现在OSx不支持本地pac文件,如果想用本地文件,需要启动本机的apache服务。

step1.  在console运行 sudo apachectl start

正常的话,用浏览器看http://localhost/  应该显示 It Works

但是却显示无法连接。

step2. 在console 运行 sudo apachectl -t

终端显示

 Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf: Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration

查资料得知LockFile 是apache2.2以前使用的,apache2.4使用的是Mutex

而osx10.11以后用的是apache2.4

step3. 修改文件 /etc/apache2/extra/httpd-mpm.conf

把以下内容隐藏

<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
  LockFile "/private/var/log/apache2/accept.lock"
</IfModule>
</IfModule>

step4. 重新测试  sudo apachectl -t 正常,运行sudo apachectl restart, 用浏览器测试正常

step5. 把Pac文件拷贝到/Library/WebServer/Documents/

step6. 设置pac文件路径为http://localhost/xxx.pac

完成

原文地址:https://www.cnblogs.com/laomanong/p/6022097.html