Недавно решил на своей рабочей машине реализовать такие более устойчивую схему сервера, чем «Сервер за 5 мин на Ubuntu». Походу экспериментов над Agilia, стал ставить на ней.
Устанавливаем всё, что надо:
mpkg install httpd mysql php
Настроить /etc/httpd/httpd.conf:

  1. <IfModule dir_module>
  2.     DirectoryIndex index.html index.htm
  3. </IfModule>

Заменить на

  1. <IfModule dir_module>
  2.     DirectoryIndex index.html index.htm index.php
  3. </IfModule>

Строку

  1. #Include /etc/httpd/mod_php.conf

раскомментрировать
что было

  1. Include /etc/httpd/mod_php.conf

Строку:

  1. #Include /etc/httpd/extra/httpd-vhosts.conf

так же раскомментировать
Строку:

  1. #ServerName www.example.com:80

заменить на

  1. ServerName localhost

Добавить ниже строку:

  1. NameVirtualHost *:80

Создаём каталоги и файлы, делаем их читаемыми и записываемыми группе, в которой запущен apache, либо всем, если не страшно.
/home/nikita/server/domain/www
/home/nikita/server/domain/log/error.log
/home/nikita/server/domain/log/custom.log
/home/nikita/server/localhost/www
/home/nikita/server/localhost/log/error.log
/home/nikita/server/localhost/log/custom.log
В данном примере: domain — имя нашего домена
Путь и структуру каталогов вы можете выбрать сами. Для меня удобней такая.
В файле:
/etc/httpd/extra/httpd-vhosts.conf
добавляем 2 виртуальных хоста, а все виртуальных хосты, что были раньше, удаляем. То есть получится такое содержание, не учитывая комментарии:

  1. <VirtualHost domain:80>
  2.     ServerAdmin admin@localhost
  3.     DocumentRoot "/home/nikita/server/domain/www"
  4.     ServerName domain
  5.    
  6.     ErrorLog "/home/nikita/server/domain/log/error.log"
  7.     CustomLog "/home/nikita/server/domain/log/custom.log" common
  8.     <Directory "/home/nikita/server/domain/www/">
  9.     AllowOverride All
  10.     Order allow,deny
  11.     Allow from all
  12.     </Directory>
  13. </VirtualHost>
  14.  
  15. <VirtualHost localhost:80>
  16.     ServerAdmin admin@localhost
  17.     DocumentRoot "/home/nikita/server/localhost/www"
  18.     ServerName localhost
  19.    
  20.     ErrorLog "/home/nikita/server/localhost/log/error.log"
  21.     CustomLog "/home/nikita/server/localhost/log/custom.log" common
  22.     <Directory "/home/nikita/server/localhost/www/">
  23.     AllowOverride All
  24.     Order allow,deny
  25.     Allow from all
  26.     </Directory>
  27. </VirtualHost>

В файле /etc/hosts прописываем дополнительные строки:
domain 127.0.0.1
Запускаем apache и mysql:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/mysql start

Первоначальная настройка mysql:
mysql -u root mysql
UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';
new_password — ваш новый root пароль
FLUSH PRIVILEGES;
exit
Теперь нам надо сделать так, чтоб apache сам запускался при старте системы и сам завершался при её выключении.
В файл /etc/conf.d/local (возможно его не будет существовать, не пугайтесь) добавить такое:

  1. local_start() {
  2.     # This is a good place to load any misc programs
  3.     # on startup (use &>/dev/null to hide output)
  4.    
  5.     /etc/init.d/apache2 start
  6.     /etc/init.d/mysql start
  7.  
  8.     # We should always return 0
  9.     return 0
  10. }
  11. local_stop() {
  12.     # This is a good place to unload any misc.
  13.     # programs you started above.
  14.  
  15.     /etc/init.d/apache2 stop   
  16.     /etc/init.d/mysql stop
  17.    
  18.     # We should always return 0
  19.     return 0
  20. }

Если он уже существует:
В разделы local_start() и local_stop() добавить:
/etc/init.d/apache2 start
/etc/init.d/mysql start
и
/etc/init.d/apache2 stop
/etc/init.d/mysql stop
соответственно.
Продолжение следует…