Таким образом, я пытаюсь изменить DocumentRoot своего апача, но по некоторой странной причине это просто, кажется, игнорирует файл/etc/apache2/sites-available/00-default.conf
Это - содержание файла:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webroot@localhost
DocumentRoot /home/david/www
<Directory /home/david/www>
Options Indexes
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Apache игнорирует sites-available
, пока Вы не включаете сайт (в этом случае он символьные ссылки он в sites-enabled
).
Выполнение следующие команды:
sudo a2dissite 000-default
sudo a2ensite 000-default
sudo systemctl restart apache2
Это отключит сайт "По умолчанию", включит сайт "По умолчанию", и затем перезапуск Apache обновит конфигурацию и должен затем использовать обновленный docroot соответственно. Примечание там может быть другими вопросами полномочий, не обсуждаемыми здесь; необходимо было бы открыть новый вопрос для этого.
Попытайтесь удалить.
<Directory /home/david/www>
Options Indexes
Require all granted
</Directory>
Пример:
VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/david/www>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
апач Перезагрузки.
Ни одно из вышеупомянутых решений не работало на меня. Независимо от того, что я попробовал, я не мог заставить сайт по умолчанию загружаться включая копирование конфигурации от моих 14.04 VPS, где это работает 100% (я обновляю до 18,04).
В конце, добавляющем VirtualHost для названия локального сервера к моему apache2.conf, вынуждающему это быть первым определенным VirtualHost, работал. Не мое предпочтительное решение, но работал:
<VirtualHost webserver.mydomain.za:80>
ServerAdmin webmaster@mydomain.za
ServerName webserver.mydomain.za
DocumentRoot /var/www/nowebsite
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Странно достаточно, Значение по умолчанию сайт SSL в работавший первый раз.