У меня много виртуальных хостов Apache 2.2 с одинаковой конфигурацией:
<VirtualHost *:80>
ServerAdmin webmaster@site.com
ServerName site.com
ServerAlias www.site.com
DocumentRoot /home/site.com/htdocs/
ErrorLog /home/site.com/logs/error.log
CustomLog /home/site.com/logs/access.log common
AssignUserID site.com ftp
<Directory /home/site.com/htdocs/>
DirectoryIndex index.html index.htm index.php
Options Includes FollowSymLinks SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Я получаю ошибки при попытке запустить ту же конфигурацию на Apache 2.4:
Performing sanity check on apache24 configuration:
AH00526: Syntax error on line 8 of /usr/local/etc/apache24/Includes/site.com.conf:
Invalid command 'AssignUserID', perhaps misspelled or defined by a module not included in the server configuration
К сожалению, я не смог найти способ использовать свою конфигурацию с Apache 2.4. Помогите решить проблему.
Я связался с разработчиком порта apache24:
You need to load mpm-itk into apache 2.4. There is pending port with
mpm-itk for apache 2.4:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=188992
It's waiting for almost three months for some good soul to pick it up :)
... Вс 13 июл 23:21:42 UTC 2014 добавлен новый порт:
- new port mod_mpm_itk for apache24
apache2-mpm-itk (just mpm-itk for short) is an MPM (Multi-Processing Module)
for the Apache web server. mpm-itk allows you to run each of your vhost
under a separate uid and gid - in short, the scripts and configuration files
for one vhost no longer have to be readable for all the other vhosts.
Я не знаком с FreeBSD, но вам каким-то образом придется установить MPM-ITK для apache 2.4. Например, в Ubuntu это будет что-то вроде sudo apt-get install apache2-mpm-itk
Затем в конфигурации apache необходимо включить модуль MPM-ITK. Раскомментируйте / добавьте строку ниже.
LoadModule mpm_event_module /path/to/apache2/modules/mod_mpm_itk.so
Также, allow from all
больше не работает в apache2.4; должно быть Require all granted
. Приведенный ниже виртуальный хост должен работать после установки mpm-itk
.
<VirtualHost *:80>
ServerAdmin webmaster@site.com
ServerName site.com
ServerAlias www.site.com
DocumentRoot /home/site.com/htdocs/
ErrorLog /home/site.com/logs/error.log
CustomLog /home/site.com/logs/access.log common
AssignUserID site.com ftp
<Directory /home/site.com/htdocs/>
DirectoryIndex index.html index.htm index.php
Options Includes FollowSymLinks SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Если кто-то работает с CentOS 7.1, вот подход, который сработал для меня:
Установите пакет httpd-itk:
]# yum install httpd-itk
Создайте свою системную учетную запись пользователя (для использования в блоке VirtualHost)
]# useradd -r itkuser
<VirtualHost *:80> DocumentRoot /var/www/html/dpumc.net ServerName example.com AssignUserID itkuser itkuser </VirtualHost>