Mac:Apache配置:修订间差异
imported>Riguz 创建页面,内容为“<source lang="bash"> sudo apachectl start </source> Category:Linux/Unix” |
imported>Riguz 无编辑摘要 |
||
第2行: | 第2行: | ||
sudo apachectl start | sudo apachectl start | ||
</source> | </source> | ||
修改/etc/apache2/httpd.conf | |||
<pre> | |||
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so | |||
LoadModule rewrite_module libexec/apache2/mod_rewrite.so | |||
LoadModule php7_module libexec/apache2/libphp7.so | |||
Include /private/etc/apache2/extra/httpd-vhosts.conf | |||
</pre> | |||
修改httpd-vhosts.conf | |||
<pre> | |||
<VirtualHost *:80> | |||
ServerAdmin dr@riguz.com | |||
DocumentRoot "/Users/hfli/Sites/riguz.com" | |||
ServerName local.riguz.com | |||
ServerAlias www.local.riguz.com | |||
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log" | |||
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common | |||
<Directory "/Users/hfli/Sites/riguz.com"> | |||
Options Indexes FollowSymLinks MultiViews | |||
AllowOverride None | |||
Require all granted | |||
</Directory> | |||
</VirtualHost> | |||
</pre> | |||
然后在/Users/hfli/Sites/riguz.com中创建index.php | |||
<source lang="php"> | |||
<?php | |||
phpinfo(); | |||
?> | |||
</source> | |||
最后需要修改local.riguz.com指向本机。然后重启Apache即可。 | |||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2018年7月16日 (一) 06:12的最新版本
sudo apachectl start
修改/etc/apache2/httpd.conf
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so LoadModule rewrite_module libexec/apache2/mod_rewrite.so LoadModule php7_module libexec/apache2/libphp7.so Include /private/etc/apache2/extra/httpd-vhosts.conf
修改httpd-vhosts.conf
<VirtualHost *:80> ServerAdmin dr@riguz.com DocumentRoot "/Users/hfli/Sites/riguz.com" ServerName local.riguz.com ServerAlias www.local.riguz.com ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log" CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common <Directory "/Users/hfli/Sites/riguz.com"> Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted </Directory> </VirtualHost>
然后在/Users/hfli/Sites/riguz.com中创建index.php
<?php
phpinfo();
?>
最后需要修改local.riguz.com指向本机。然后重启Apache即可。