铭哥和佩佩的博客

铭哥和佩佩的博客分享Python、PHP、JavaScript、HTML5、CSS3等各种知识

mac下配置多域名

1.配置 /etc/apache2/httpd.conf
开启相应的模块
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf(打开注释)
2.配置多域名 httpd-vhosts.conf
在/etc/apache2/extra/httpd-vhosts.conf 配置相关选项
<VirtualHost *:80>
ServerAdmin webmaster@test.com
DocumentRoot "/Library/www/app"
ServerName test.test.com
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
<Directory "/Library/www/app">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted

<VirtualHost :80>
ServerAdmin webmaster@browser.com
DocumentRoot "/Library/www/browser/public"
ServerName xiaoniao.browser.com
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
<Directory "/Library/www/browser/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .
index.php


3.配置host
vim /etc/hosts 下配置相关域名
127.0.0.1 xiaoniao.browser.com
4.重启apache
sudo apachectl restart

none

添加新评论