проблема конфигурации веб-сервера apache - PullRequest
0 голосов
/ 19 мая 2010

Я хочу, чтобы сервер Apache обслуживал только / var / www / directory теперь он обслуживает все мои файлы в системе из каталога "/"
я попытался отредактировать httpd.conf, помещенный в / etc / apache2 и поместив в него следующее содержимое (изначально оно было пустым)

<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 в папке sites-available повторил тот же процесс

все еще 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 голосов
/ 25 февраля 2012

Проверьте / etc / apache2 / sites-enabled

Вы видите сайт с именем "000-default" или похожим? если его нет в списке, я бы набрал:

sudo a2ensite default

Кроме того, следите за своим /etc/apache2/sites-available/default файлом.

У вас должно быть что-то похожее на ниже. Я лично добавил строку DocumentRoot / var / www над моей строкой VirtualHost.

<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>
0 голосов
/ 19 мая 2010

Сделать так:

<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">
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...