Lri*_*Lri 11
Web 共享复选框在 10.8 中被删除,但sudo apachectl start也永久启用了启动代理(请参阅 参考资料cat /usr/sbin/apachectl)。为了http://localhost/~username/工作,您可以将这样的内容保存为/etc/apache2/users/username.conf:
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
如果要将 localhost 定向到~/Sites/,可以在/etc/apache2/httpd.conf.
您可以通过取消注释添加一个虚拟主机Include /private/etc/apache2/extra/httpd-vhosts.conf中/etc/apache2/httpd.conf,添加127.0.0.1 testsite.dev到/etc/hosts,并添加这/etc/apache2/extra/httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "/Users/username/Sites/testsite/"
ServerName testsite.dev
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
sudo apachectl restart 应用更改。
打开系统偏好设置»共享,并启用网络共享。
在 Mountain Lion网络共享已从首选项中删除,因此用于sudo apachectl start启动 Apache。
您会在那里找到指定的 URL。例如,我的Sites文件夹/Users/danielbeck/Sites可以作为http://10.0.1.2/~danielbeck/.
| 归档时间: |
|
| 查看次数: |
50180 次 |
| 最近记录: |