2010-05-19 147 views
0

我想有Apache服务器只服务于 在/ var/WWW /目录 现在它提供对系统所有我的文件从目录 “/”
我试图修改httpd.conf文件放置在在/ etc/apache2的,放在folllowing内容在里面(intially它是空的)Apache Web服务器的配置问题

<Directory /> 
    Options None 
    AllowOverride None 
</Directory> 
DocumentRoot "/var/www" 

<Directory "/var/www"> 
    Options Indexes FollowSymLinks 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory> 

然后保存它,重新启动Apache服务器 摆正位置在/ var/WWW的网页浏览器地址栏,它仍然显示更高层次的目录 然后我编辑的文件默认,Default-ssl的网站 - 可用文件夹 重复同样的过程

还是Apache的服务我的系统上的所有文件


2.当我尝试使用下面的命令

gedit httpd.conf 

我得到的错误

gedit:2696): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported 

GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.) 

回答

0

使它看起来像这样:

<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
    Order deny,allow 
    Deny from all 
</Directory> 

# 
# Note that from this point forward you must specifically allow 
# particular features to be enabled - so if something's not working as 
# you might expect, make sure that you have specifically enabled it 
# below. 
# 

# 
# This should be changed to whatever you set DocumentRoot to. 
# 
<Directory "/var/www"> 
0

退房的/ etc/

的Apache2 /启用网站,你看到一个名为 “000-默认” 或类似的上市网站? 如果未列出它,我会键入:

sudo a2ensite default 

此外,猫的/etc/apache2/sites-available/default文件。

你应该有类似的东西在下面。我亲自在我的VirtualHost行上面添加了一个DocumentRoot/var/www一行。

<VirtualHost *:80> 
    ServerAdmin [email protected] 

    DocumentRoot /var/www 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      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> 

    ErrorLog ${APACHE_LOG_DIR}/error.log 

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

    CustomLog ${APACHE_LOG_DIR}/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>