AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 779143
Accepted
MitchellK
MitchellK
Asked: 2016-05-27 01:56:58 +0800 CST2016-05-27 01:56:58 +0800 CST 2016-05-27 01:56:58 +0800 CST

Apache 不断恢复到 mpm_prefork (Apache 2.4.7 / Ubuntu 14.04.2)

  • 772

我已经有这个问题超过一年了,每次 Ubuntu 有安全更新并且我必须重新启动服务器时,Apache 2.4 决定开始使用 mpm_prefork 工作程序,尽管我已将 mpm_event 设置为 / 中的启用模块etc/apache2/mods 启用。

我什至在 /etc/apache2/mods-available 中编辑 mpm_prefork.conf 文件并注释掉它加载模块的位置,但今天早上重新启动后,apache 根本不会启动,因为它坚持使用 Prefork 启动.

这是我的 /etc/apache2/mods-enabled/ 目录列表

access_compat.load
actions.conf
actions.load
alias.conf
alias.load
auth_basic.load
authn_core.load
authn_file.load
authz_core.load
authz_host.load
authz_user.load
autoindex.conf
autoindex.load
deflate.conf
deflate.load
dir.conf
dir.load
env.load
evasive.conf
evasive.load
expires.load
fastcgi.conf
fastcgi.load
filter.load
headers.load
mime.conf
mime.load
mpm_event.conf
mpm_event.load
negotiation.conf
negotiation.load
pagespeed.conf
pagespeed.load
rewrite.load
setenvif.conf
setenvif.load
socache_shmcb.load
spamhaus.conf
spamhaus.load
ssl.conf
ssl.load
status.conf
status.load

我通过运行 apache2 -l 检查它是否已编译到 Apache 中,这是输出

Compiled in modules:
  core.c
  mod_so.c
  mod_watchdog.c
  http_core.c
  mod_log_config.c
  mod_logio.c
  mod_version.c
  mod_unixd.c

最后 a2query -M 的结果是

sudo a2query -M
event

但是,如果我现在重新启动,Apache 会在启动时死机,因为它需要 mpm_prefork 模块,正如我所说,我已经通过在其 .conf 文件中注释掉它来禁用它以防止它加载,这不是解决我的问题的方法。

老实说,我对 Apache 2.4 一直在自己决定加载 mpm_prefork 的地方感到困惑。

这也是我没有注释的 apache2.conf 文件

# Global configuration
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 40
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostNameLookups Off
ErrorLog ${APACHE_LOG_DIR}/apache-error.log
LogLevel warn
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
SetEnvIf Remote_Addr "::1" loopback
CustomLog ${APACHE_LOG_DIR}/apache-access.log combined env=!loopback

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


<Directory />
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/html/opcache/>
    Options -Indexes +FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>


AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

LogFormat "%V %v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%h %l %u %t \"%r\" %>s %O %b %D \"%{Referer}i\" \"%{User-Agent}i\"" custom


IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf
httpd.conf apache-2.4 mpm-prefork
  • 1 1 个回答
  • 2145 Views

1 个回答

  • Voted
  1. Best Answer
    Colt
    2016-05-27T05:22:14+08:002016-05-27T05:22:14+08:00

    问题似乎是您将这些安装为软件包:

    apache2-mpm-event 2.4.7-1ubuntu4.9 amd64 transitional event MPM package for apache2
    apache2-mpm-prefork 2.4.7-1ubuntu4.9 amd64 transitional prefork MPM package for apache2
    

    当您更新时,您会明确告诉服务器安装 prefork 版本。如果您在 Ubuntu 14.04 上正确安装了 Apache2,它不会指定 MPM 类型,则 adpkg -l | grep apache2将包括:

    apache2 2.4.7-1ubuntu4.9 amd64 Apache HTTP Server
    

    但不会显示您列出的两个包。

    在 Ubuntu 14.04 上正确安装 Apache2很简单:

    sudo apt-get install apache2
    

    没有任何 MPM 规范。基本的多处理模块是 Apache 2.4 的核心功能,并且包含在 apache2 安装中。

    然后按如下方式设置 MPM:

    要确定当前正在使用哪个 MPM,请运行apache2ctl -V. 您将看到如下一行:

     Server MPM:     prefork
    

    例如,假设您在apache2ctl -V安装后运行“prefork”(如上面的示例结果),则使用以下命令切换到“event”:

     sudo a2dismod mpm_prefork
     sudo a2enmod mpm_event
     sudo service apache2 restart
    

    这将设置正确的符号链接。

    一旦以这种方式设置,在正确安装下,更新将不会更改您的设置。

    注意:您对文件的“编辑”*.conf应该在目录中进行,在该/etc/apache2/mods-available目录中保护它们不会在更新期间被过度写入。该/etc/apache2/mods-enabled目录将只有符号链接回到/etc/apache2/mods-available.

    • 1

相关问题

  • 显示 Apache 配置

  • 如何将我的更改粘贴在 WHM/Cpanel/EasyApache 上的 httpd.conf [关闭]

  • RHEL 4 可以使用两个不同的配置文件运行两个 apache httpd 实例吗?

  • 如何找出运行时使用的 httpd.conf apache

  • httpd.conf 并设置别名

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve