0. 启用rewrite module: LoadModule rewrite_module libexec/apache2/mod_rewrite.so 1. 修改apache配置文件httpd.conf, 取消下面这行代码的注释 Include /private/etc/apache2/extra/httpd-vhosts.conf 去掉前面的# 2. 修改httpd-vhosts.conf<VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot “/path-to-your-yangzie-dir/app/public_html” ServerName YOUR-DOMAIN.com ServerAliasYOUR-DOMAIN.com ErrorLog “/path-to-your-log-dir/YOUR-DOMAIN.com-error_log” CustomLog “/path-to-your-log-dir/YOUR-DOMAIN.com-access_log” common <Directory “/path-to-your-yangzie-dir/app/public_html”> AllowOverride All Require all granted </Directory> </VirtualHost># 如果localhost不能访问,则加上下面这句 <VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot “/path-to-your-localhost-dir” ServerName localhost ErrorLog “/path-to-your-log-dir/localhost-error_log” CustomLog “/path-to-your-log-dir/localhost-access_log” common <Directory “/path-to-your-localhost-dir”> Options All AllowOverride All Require all granted </Directory> </VirtualHost> |
1. 修改nginx配置文件如下: server { root path-to-your-yangzie-dir/app/public_html; index index.html index.php index.htm;server_name YOUR_DOMAIN.com } |