Debian/Ubuntu - 404 Not Found
Модераторы: Warderer, Модераторы разделов
Debian/Ubuntu - 404 Not Found
Здравствуйте, такая проблема установлен debian 8 дальше LAMP настроил виртуальный хост когда перехожу по ip/test.com(домен не покупал) получаю ошибку 404 Not Found
1. Обновляю базы репозитариев apt-get update
2. Обновляю ПО apt-get upgrade
3. Ставлю apache apt-get install apache2
4. Ставлю mysql apt-get install mysql-server
5. Ставлю PHP5 apt-get install php5 php-pear php5-mysql
6. в var/www/test.com - создаю папку test.com
7. cd /etc/apache2/sites-available
cp 000-default.conf test.com.conf - редактирую
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.com
</VirtualHost>
8. включаю виртуальный хост a2ensite test.com
9. service apache2 restart
захожу 192.168.0.5/test.com
Not Found
The requested URL /test.com/ was not found on this server.
Дефолтный конфиг
<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 webmaster@localhost
DocumentRoot /var/www/html
# 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
1. Обновляю базы репозитариев apt-get update
2. Обновляю ПО apt-get upgrade
3. Ставлю apache apt-get install apache2
4. Ставлю mysql apt-get install mysql-server
5. Ставлю PHP5 apt-get install php5 php-pear php5-mysql
6. в var/www/test.com - создаю папку test.com
7. cd /etc/apache2/sites-available
cp 000-default.conf test.com.conf - редактирую
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.com
</VirtualHost>
8. включаю виртуальный хост a2ensite test.com
9. service apache2 restart
захожу 192.168.0.5/test.com
Not Found
The requested URL /test.com/ was not found on this server.
Дефолтный конфиг
<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 webmaster@localhost
DocumentRoot /var/www/html
# 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
- Bizdelnick
- Модератор
- Сообщения: 20794
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Debian/Ubuntu - 404 Not Found
А зачем Вы туда заходите? Когда Вы обращаетесь по IP-адресу, Вы попадаете сюда:
Rubiks писал(а): ↑13.10.2015 11:31Код: Выделить всё
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Каталога /var/www/html/test.com нет, и Вы закономерно получаете ошибку 404.
Пишите правильно:
в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
Спасибо сказали:
Re: Debian/Ubuntu - 404 Not Found
Bizdelnick - спасибо понял в дефолном конфиге нужно папку по правит var/www. Но когда захожу по ip отображается дерево папок в debian7 проблема решалась
<Directory /var/www/>
# минус перед Indexes:
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
когда зайти по ip страница запрещена сервером, а как в 8
<Directory /var/www/>
# минус перед Indexes:
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
когда зайти по ip страница запрещена сервером, а как в 8
- Bizdelnick
- Модератор
- Сообщения: 20794
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Debian/Ubuntu - 404 Not Found
Неправильно поняли. Дефолтный конфиг править не надо. Надо обращаться по имени хоста, а не по IP, чтобы попасть на виртуальный хост. Ну или переместить test.com в /var/www/html (конфиг для виртуального хоста вообще не нужен, если будете обращаться только по IP; если хотите использовать оба варианта, то или исправьте docroot на /var/www/html/test.com, или вместо перемещения сделайте симлинк /var/www/html/test.com -> ../test.com).
Пишите правильно:
в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
Re: Debian/Ubuntu - 404 Not Found
Дефолтный конфиг править не надо.
Вернул.
виртуальные хосты не нужны даже если сайтов будет 5-10 (домены не покупал)
ip/site1.com
ip/site2.com
ip/site3.com
и так далее
Re: Debian/Ubuntu - 404 Not Found
переместил test.com в /var/www/
как отключить листинг файлов, которые вылезли при удалении html-файла с "It Works!"
как отключить листинг файлов, которые вылезли при удалении html-файла с "It Works!"
- Bizdelnick
- Модератор
- Сообщения: 20794
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Debian/Ubuntu - 404 Not Found
Поставьте минус перед Indexes, как делали раньше. Когда я писал, что дефолтный конфиг менять не надо, имел в виду только, что не надо переносить docroot на уровень выше. Извините, что неточно выразился.
Пишите правильно:
в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
Re: Debian/Ubuntu - 404 Not Found
добавил но вылазит ошибка при перезагрузке
service apache2 restart
[FAIL] Restarting web server: apache2 failed!
[warn] The apache2 configtest failed. ... (warning).
Output of config test was:
AH00526: Syntax error on line 15 of /etc/apache2/sites-enabled/000-default.conf:
Either all Options must start with + or -, or no Option may.
Action 'configtest' failed.
The Apache error log may have more information.
000-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 webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</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
service apache2 restart
[FAIL] Restarting web server: apache2 failed!
[warn] The apache2 configtest failed. ... (warning).
Output of config test was:
AH00526: Syntax error on line 15 of /etc/apache2/sites-enabled/000-default.conf:
Either all Options must start with + or -, or no Option may.
Action 'configtest' failed.
The Apache error log may have more information.
000-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 webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</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
- Bizdelnick
- Модератор
- Сообщения: 20794
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Debian/Ubuntu - 404 Not Found
Перевести? ☺
Пишите правильно:
в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
Re: Debian/Ubuntu - 404 Not Found
я перевел
Либо все параметры должны начинаться с + или -, или нет опция может.
пробовал так
Options -Indexes -FollowSymLinks -MultiViews
ошибки нет при перезагрузке apache но не работает
Либо все параметры должны начинаться с + или -, или нет опция может.
пробовал так
Options -Indexes -FollowSymLinks -MultiViews
ошибки нет при перезагрузке apache но не работает
- Bizdelnick
- Модератор
- Сообщения: 20794
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Debian/Ubuntu - 404 Not Found
Код: Выделить всё
Options -Indexes +FollowSymLinks +MultiViews
Пишите правильно:
в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
Спасибо сказали:
Re: Debian/Ubuntu - 404 Not Found
спасибо большое Bizdelnick подскажите пж еще момент как скрыть http://joxi.ru/nAyeyRLhoR5NAZ версию apache ip и так далее
- Bizdelnick
- Модератор
- Сообщения: 20794
- Статус: nulla salus bello
- ОС: Debian GNU/Linux
Re: Debian/Ubuntu - 404 Not Found
А смысл? Кто захочет — из HTTP-заголовков вытащит.
Пишите правильно:
в консоли вку́пе (с чем-либо) в общем вообще | в течение (часа) новичок нюанс по умолчанию | приемлемо проблема пробовать трафик |
Re: Debian/Ubuntu - 404 Not Found
Спасибо Bizdelnick проблема решена.