【问题标题】:apache web server configuration problemapache web服务器配置问题
【发布时间】:2011-02-21 04:35:33
【问题描述】:

我只想让 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 放在网络浏览器地址栏中,它仍然显示更高级别的目录 然后我在站点可用文件夹中编辑了文件 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.)

【问题讨论】:

    标签: apache2


    【解决方案1】:

    让它看起来像这样:

    <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">
    

    【讨论】:

      【解决方案2】:

      查看 /etc/apache2/sites-enabled

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

      sudo a2ensite default
      

      另外,cat 你的/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>
      

      【讨论】:

        猜你喜欢
        • 2011-04-07
        • 2011-08-14
        • 1970-01-01
        • 1970-01-01
        • 2010-11-10
        • 1970-01-01
        • 2010-10-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多