【问题标题】:Trying to get subdomains working on my server试图让子域在我的服务器上工作
【发布时间】:2012-02-12 14:26:35
【问题描述】:

我正在尝试让子域适用于我正在开发的网络应用程序。我遵循了这个 tut http://net.tutsplus.com/tutorials/php/basecamp-style-subdomains-with-codeigniter/ 并且通过将我的 url 添加到我的 /etc/hosts 文件然后将以下内容添加到我的 httpd.config 文件中,我能够让它在本地工作

<VirtualHost *:80>  
    DocumentRoot "/Users/username/Sites/snapGiftApp"  
    ServerName snapgiftapp.com  
    ServerAlias snapgiftapp.com  

    <Directory "/Users/username/Sites/snapGiftApp">  
        Options -Indexes  
        Options FollowSymLinks  
        AllowOverride All  
    </Directory>  
</VirtualHost>  

<VirtualHost *:80>  
    DocumentRoot "/Users/username/Sites/snapGiftApp"  
    ServerName snapgiftapp.com  
    ServerAlias *.snapgiftapp.com  

    <Directory "/Users/username/Sites/snapGiftApp">  
        Options -Indexes  
        Options FollowSymLinks  
        AllowOverride All  
    </Directory>  
</VirtualHost>

我现在正试图让它在我的服务器上运行,但我无法让子域部分正常运行。如果你去http://snapgiftapp.com,你会看到登陆页面就好了。如果您转到任何http://subdomain.snapgiftapp.com,您会看到一个错误页面。

我在我的 dns 中添加了一个通配符子域,并在我的 httpd.config 文件中添加了以下内容,但在查看 http://subdomain.snapgiftapp.com 时仍然出现错误

<VirtualHost *:80>
    DocumentRoot "/home/snapgift"  
    ServerName snapgiftapp.com  
    ServerAlias snapgiftapp.com  

    <Directory "/home/snapgift">  
        Options -Indexes  
        Options FollowSymLinks  
        AllowOverride All  
    </Directory>  
</VirtualHost>  

<VirtualHost *:80>  
    DocumentRoot "/home/snapgift"  
    ServerName snapgiftapp.com  
    ServerAlias *.snapgiftapp.com  

    <Directory "/home/snapgift">  
        Options -Indexes  
        Options FollowSymLinks  
        AllowOverride All  
    </Directory>  
</VirtualHost>

我在服务器上做错了什么,这不起作用?我需要提供目录的完整路径吗?即 /var/www/etc/etc.. ?

【问题讨论】:

    标签: apache hosting subdomain virtualhost


    【解决方案1】:

    似乎我在域名上设置了通配符 dns,而不是在实际主机上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-22
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      • 2012-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多