VHOST 在 Apache 中不起作用

Sta*_*arx 4 virtualhost apache2

我有一个在 Ubuntu 11.04 中工作的 LAMP 服务器。现在的问题是网站必须从终端启用和禁用。所有这些都必须被访问,http://localhost这样效率不高。所以我使用一些网上的教程创建了一个 VHOSTS。这是它的编码

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    Servername site.com
    ServerAlias www.site.com
    DocumentRoot /home/starx/public_html/site/public
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/starx/public_html/site/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
nGen
    ErrorLog ${APACHE_LOG_DIR}/site-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/site-access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

现在,我仍然无法访问该页面,http://site.com但是如果我使用http://localhsot/它进行访问,则会被访问。

我已经禁用了所有其他站点,包括默认站点,并且刚刚启用了一个站点,即 site

如何解决这个问题?

小智 5

我只是想让它工作,环顾四周后,我发现了我出了什么问题。

我正在为 Ubuntu 12.04 运行 xampp (lampp) 1.80。

打开 /opt/lampp/etc/httpd.conf

见第 488 行

# Virtual hosts  
# Include etc/extra/httpd-vhosts.conf
Run Code Online (Sandbox Code Playgroud)

include.
新安装不会加载httpd-vhosts.conf开箱即用。