环境

Ubuntu 18.04.3 + Apache 2.4.29

目标:AssignUserId www-data www-data

 

解决办法

  1. sudo apt-get install libapache2-mpm-itk
  2. sudo a2enmod mpm_itk
  3. sudo apache2ctl restart

 

完整过程

root@weVPS:/etc/apache2/sites-enabled# cat demo.com.conf
<VirtualHost *:80>	
	ServerName demo.com
	DocumentRoot /var/www/democom/
	AssignUserId www-data www-data	
	ErrorLog /var/log/apache2/demo.log
</VirtualHost>
root@weVPS:/etc/apache2/sites-enabled# apache2ctl restart
AH00526: Syntax error on line 4 of /etc/apache2/sites-enabled/demo.com.conf:
Invalid command 'AssignUserId', perhaps misspelled or defined by a module not included in the server configuration
Action 'restart' failed.
The Apache error log may have more information.
root@weVPS:/etc/apache2/sites-enabled# cd ../mods-available/
root@weVPS:/etc/apache2/mods-available# 
root@weVPS:/etc/apache2/mods-available# ls mpm*
mpm_event.conf  mpm_event.load  mpm_prefork.conf  mpm_prefork.load  mpm_worker.conf  mpm_worker.load
root@weVPS:/etc/apache2/mods-available# 
root@weVPS:/etc/apache2/mods-available# apt-get install libapache2-mpm-itk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libapache2-mpm-itk
0 upgraded, 1 newly installed, 0 to remove and 93 not upgraded.
Need to get 10.8 kB of archives.
After this operation, 45.1 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe amd64 libapache2-mpm-itk amd64 2.4.7-04-1 [10.8 kB]
Fetched 10.8 kB in 0s (585 kB/s)        
Selecting previously unselected package libapache2-mpm-itk.
(Reading database ... 112513 files and directories currently installed.)
Preparing to unpack .../libapache2-mpm-itk_2.4.7-04-1_amd64.deb ...
Unpacking libapache2-mpm-itk (2.4.7-04-1) ...
Setting up libapache2-mpm-itk (2.4.7-04-1) ...
apache2_invoke: Enable module mpm_itk
root@weVPS:/etc/apache2/mods-available# 
root@weVPS:/etc/apache2/mods-available# ls mpm*
mpm_event.conf  mpm_event.load  mpm_itk.load  mpm_prefork.conf  mpm_prefork.load  mpm_worker.conf  mpm_worker.load
root@weVPS:/etc/apache2/mods-available# cd /etc/apache2/mods-enabled/
root@weVPS:/etc/apache2/mods-enabled# ln -s ../mods-available/mpm_itk.load .
ln: failed to create symbolic link './mpm_itk.load': File exists
root@weVPS:/etc/apache2/mods-enabled# 
root@weVPS:/etc/apache2/mods-enabled# apache2ctl restart
root@weVPS:/etc/apache2/mods-enabled# 

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐