Помогите с настройкой локального сервера на Ubuntu 14.04
По умолчанию проекты для локального сервера нужно размещать в папке /var/www. Это неудобно при переустановке системы, поэтому я хочу размещать свои проекты в домашней папке. Для этого я сделал следующие шаги:
1. Создал в домашней папке папку www, в ней создал папку mysite, в ней документ index.html
2. В папке /etc/apache2/sites-available создал копию файла 000-default.conf и назвал его mysite.conf
3. В этом файле прописал пути к моей папке /home/user/www/mysite
4. Далее включил сайт командой «sudo a2ensite mysite»
5. Потом перезагрузил apache
6. Зашел в папку /etc и отредактировал файл hosts — в первой строчке к localhost добавил mysite
Но при попытке зайти в браузере на mysite открывается та же страница, что и при адресе localhost. Что я делаю не так?
Настройка локального сервера на Ubuntu 14.04
Почему логи не смотрите?
Нужно содержимое файла mysite.conf
почему-бы вам просто симлинк с /var/www/mysite/ на $HOME/mysite не сделать? Зачем такие сложности?
Я думаю проблема в том, что DocumentRoot у вас прописан через /srv/www, а там ссылка на /var/www/. Уж не помню, как оно в Debian'е сделано…
Нужно содержимое файла mysite.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 mysite
ServerAdmin webmaster@localhost
DocumentRoot /home/golovenkin/www/mysite
# 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
#ServerName mysite
нужно разкомментировать и написать свой сайт.
#ServerName mysite
нужно разкомментировать и написать свой сайт.
Попробовал, сделал вот так:
<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 mysite
ServerAdmin webmaster@localhost
DocumentRoot /home/golovenkin/www/mysite
# 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
Ничего не изменилось :(
Сайт mysite называется?
Сайт mysite называется?
Это пока попытка настроить локальный сервер. В /home/golovenkin/www/mysite/ лежит не сайт а просто файлик index.html
И да, значит сайт называется mysite
В браузере, чтобы подключиться mysite набираете?
В hosts это прописано?
В браузере, чтобы подключиться mysite набираете?
да
У меня еще прописано приблизительно следующее:
<VirtualHost *:80>
****
<Directory "/home/golovenkin/www/mysite">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
это написано в какой части файла?
Вот полность рабочий конфиг:
<VirtualHost *:80>
ServerName mysite.ru
ServerAlias www.mysite.ru
DocumentRoot /u01/webProjects/mysite.ru
ErrorLog /u01/logs/mysite.ru/mysite.ru-error.log
CustomLog /u01/logs/mysite.ru/mysite.ru-access.log combined
<Directory "/u01/webProjects/mysite.ru">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
если не сложно, то напишите как он должен выглядеть в моем случае?
папка с сайтом: /home/golovenkin/www/mysite
неужели никто не поможет разобраться с проблемой?
golovenkin,
Попробовал, сделал вот так:
<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 mysite
ServerAdmin webmaster@localhost
DocumentRoot /home/golovenkin/www/mysite
<Directory "/home/golovenkin/www/mysite">
Options All
AllowOverride All
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, PHP, Ubuntu + IDE для разработки.
http://www.youtube.com/watch?v=B4-7FxQvDhY
http://www.youtube.com/watch?v=5A01mjisrTc