apache web服务器配置问题

时间:2010-05-19 02:20:31

标签: apache2

我想让apache服务器只提供服务 / var / www /目录 现在它从目录服务系统上的所有文件 “/”
我试图编辑位于/ etc / apache2中的httpd.conf并将下面的内容放入其中(最初是空的)

<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放在Web浏览器地址栏中,它仍然显示更高级别的目录 然后我在sites-available文件夹中编辑了Default,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.)

2 个答案:

答案 0 :(得分: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">

答案 1 :(得分:0)

查看/ etc / apache2 / sites-enabled

您是否看到列出名为“000-default”或类似名称的网站? 如果没有列出,我会输入:

sudo a2ensite default

另外,请抓住您的/etc/apache2/sites-available/default文件。

你应该有类似下面的内容。我亲自在我的VirtualHost线上方添加了一条DocumentRoot / var / www。

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    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>
相关问题