2012-07-29 152 views
0

需要完成哪些步骤加入另一个网站到OS X(Lion)?在Macbook上组织多个网站

我想在2个文件夹下的'网站'中组织2个网站,但不知道如何到达那里。从下图中可以看出,MB目前在“网站”中展示了“默认”(第一个)网站。我担心把这个默认站点放到一个Sites的文件夹中,称之为'siteA'会导致它消失。

这些网站是不是托管在此MB上。 (好吧,他们是......)它正在用于BBEdit中的开发,查看和测试。

后下面的步骤,网址http://bella,回复故宫 - 您没有权限访问/在此服务器上。 (??)

建议欢迎。提前致谢。

到目前为止,我已经添加或修改:

-- private/etc/hosts (added the following) 
127.0.0.1 bella 

-- private/etc/apache2/http.conf (uncommented 2nd line) 
# Virtual hosts 
Include /private/etc/apache2/extra/httpd-vhosts.conf 

-- /private/etc/apache2/extra/httpd-vhosts.conf (added 2 VirtualHost blocks) 
# VirtualHost example: 
# Almost any Apache directive may go into a VirtualHost container. 
# The first VirtualHost section is used for all requests that do not 
# match a ServerName or ServerAlias in any <VirtualHost> block. 
# 
<VirtualHost *:80> 
    DocumentRoot "/Library/WebServer/Documents" 
    ServerName localhost 
</VirtualHost> 

<VirtualHost *:80> 
    DocumentRoot "/Users/dolan2go/Sites/Bella" 
    ServerName bella 
</VirtualHost> 

我的MacBook的目录结构目前是这样的:

Directory structure

回答

0

必须做出一些修改得到这个工作。希望在'Sites'文件夹中有'FirstSite'&'Bella'文件夹。 (我的用户目录结构已经改变,因为HD & SSD硬件MOD)的

  1. 修改hosts.conf文件:(最后两行 - 见下面的注释)

    127.0.0.1 bella.local 
    127.0.0.1 firstSite.local 
    
  2. 取消注释行使用vhosts.conf文件(如在原来的问题)

  3. 修改的httpd-vhosts.conf到:

    # Localhost first 
    <VirtualHost *:80> 
        DocumentRoot "/Volumes/HDD 1/<username>/Sites" 
        ServerName localhost 
    </VirtualHost> 
    
    # local test Sites 
    <VirtualHost *:80> 
        DocumentRoot "/Volumes/HDD 1/<username>/Sites/FirstSite" 
        ServerName firstSite.local 
    </VirtualHost> 
    
    <VirtualHost *:80> 
        DocumentRoot "/Volumes/HDD 1/<username>/Sites/Bella" 
        ServerName bella.local 
    </VirtualHost> 
    
    # Allow from localhost only or other directives 
    <Directory "/Volumes/HDD 1/<username>/Sites/FirstSite"> 
        Order Deny,Allow 
        Allow from 127.0.0.1 
        Deny from all 
    </Directory> 
    
    <Directory "/Volumes/HDD 1/<username>/Sites/Bella"> 
        Order Deny,Allow 
        Allow from 127.0.0.1 
        Deny from all 
    </Directory> 
    

现在我可以通过twtwtw 3/4下来http://bella.local & http://firstSite.local访问这两个网站的本地版本(我决定添加本地,帮助本地和远程的版本区分开来。)

的答复Local Web Server for Lion的页面确实有助于解决问题。