JiFu's Wiki JiFu's Wiki
首页
  • HTML
  • JavaScript
  • NodeJS
  • Vuejs
  • 微信小程序
  • Python
  • 数据库
  • 中间件
  • 算法
  • 软件工程
  • Wordpress
  • iOS开发
  • Android开发
  • Linux
  • Windows
  • MacOS
  • Docker
  • Vim
  • VSCode
  • Office
  • 其他
  • Photoshop
  • Sketch
  • Mac
  • 游戏
关于
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
首页
  • HTML
  • JavaScript
  • NodeJS
  • Vuejs
  • 微信小程序
  • Python
  • 数据库
  • 中间件
  • 算法
  • 软件工程
  • Wordpress
  • iOS开发
  • Android开发
  • Linux
  • Windows
  • MacOS
  • Docker
  • Vim
  • VSCode
  • Office
  • 其他
  • Photoshop
  • Sketch
  • Mac
  • 游戏
关于
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 数据库

  • Python

  • 中间件

  • 算法

  • 软件工程

  • Wordpress

    • Wordpress介绍
    • WordPress启用memcached动态缓存以及报错解决
    • Wordpress插件列表
    • Wordpress关闭插件更新提醒
    • Wordpress钩子函数
    • Woocommerce钩子函数
    • Wordpress页面缓存优化
    • Wordpress-Woo订单修改
    • Wordpress页面优化
    • Wordpress项目手册
    • Wordpress数据库优化
    • Wordpress项目优化
    • Wordpress质量检测
    • Plesk Hosting Wordpress项目优化
      • 1. 项目优化
      • 2. PHP配置
      • 3. Apache配置
      • 4. Nginx配置
  • 后端技术
  • Wordpress
JiFu
2026-03-07
目录

Plesk Hosting Wordpress项目优化

# 1. 项目优化

# 2. PHP配置

# 2.1. PHP Performance

# memory_limit

The maximum amount of memory in bytes a script is allowed to allocate. 脚本允许分配的最大内存量,单位为字节 (通常设置为服务器内存的 1/4 或更高,建议初始值为 256M,根据实际情况调整)。

512M

# max_execution_time

The maximum time in seconds a script is allowed to run before it is terminated. 脚本允许运行的最长时间,单位为秒 (通常设置为服务器允许的最大值,建议初始值为 300,根据实际情况调整)。

6000

# max_input_time

The maximum time in seconds a script is allowed to parse input data. 脚本允许解析输入数据的最长时间,单位为秒 (通常设置为服务器允许的最大值,建议初始值为 300,根据实际情况调整)。

3000

# post_max_size

The maximum size in bytes of data that can be posted with the POST method. Typically, should be larger than upload_max_filesize and smaller than memory_limit. 使用POST方法可以提交的最大数据大小,通常应大于upload_max_filesize且小于memory_limit。

64M

# upload_max_filesize

The maximum size in bytes of an uploaded file. 上传文件的最大大小,通常设置为 64M 或更高,具体取决于网站需求。

256M

# opcache.enable

Enables or disables the opcode cache. 启用或禁用操作码缓存,建议设置为 1 以提高性能。

on

# 2.2 PHP-FPM settings

# pm.max_children

根据服务器资源和网站流量调整,通常设置为服务器内存允许的最大值,建议初始值为 50-100,根据实际情况调整。

10

# pm.max_requests

设置为 500 ~ 1000,防止内存泄漏和性能下降。

500

# pm

设置为 dynamic,允许根据需求动态调整子进程数量,适合大多数情况。

dynamic

# pm.start_servers

设置为 2-10,确保在高峰期有足够的子进程处理请求。

2 当前为最低配, 大量流量网站建议设置为 5~10,根据实际情况调整。

2

# pm.min_spare_servers

设置为 1- 5,确保有足够的空闲子进程处理突发流量。

1 当前为最低配, 大量流量网站建议设置为 2~5,根据实际情况调整。

1

# pm.max_spare_servers

设置为 3-20,防止过多的空闲子进程占用资源。

3 当前为最低配, 大量流量网站建议设置为 10~20,根据实际情况调整。

3

# 3. PHP Additional configuration directives

Opcache配置优化,建议根据服务器资源和网站需求调整,以下是推荐的配置:

; Additional directives added by Plesk Optimization Settings
; DO NOT MODIFY THIS FIELD BECAUSE IT WAS GENERATED AUTOMATICALLY
; SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE BLOCK IS GENERATED.
opcache.huge_code_pages=1
opcache.interned_strings_buffer=64
opcache.jit=1254
opcache.jit_buffer_size=32M
opcache.max_accelerated_files=1000
opcache.max_wasted_percentage=15
opcache.memory_consumption=128
opcache.revalidate_path=0
; Additional directives added by Plesk Optimization Settings
1
2
3
4
5
6
7
8
9
10
11
12

# 3. Apache配置

# 3.1. Additional directives for HTTPS

Apache 服务器中常用的 静态资源缓存配置,主要通过 mod_expires 和 mod_headers 两个模块来控制浏览器缓存,目的是减少服务器请求次数、加快页面加载速度。

  • 作用:开启 Expires 功能,让浏览器缓存指定类型的文件,并指定缓存有效期。

  • ExpiresActive On → 开启 mod_expires 功能。

  • ExpiresByType → 按 MIME 类型设置过期时间,例如:

    • 图片(jpg、jpeg、png、gif)缓存 30 天
    • CSS 和 JS 缓存 7 天
    • PDF 文件缓存 30 天
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType image/jpg "access plus 30d"
	ExpiresByType image/jpeg "access plus 30d"
	ExpiresByType image/png "access plus 30d"
	ExpiresByType image/gif "access plus 30d"
	ExpiresByType text/css "access plus 7d"
	ExpiresByType application/javascript "access plus 7d"
	ExpiresByType text/javascript "access plus 7d"
	ExpiresByType application/pdf "access plus 30d"
</IfModule>

<IfModule mod_headers.c>
	<FilesMatch "\.(jpg|jpeg|png|gif|css|js|pdf|woff2|woff|ttf)$">
		Header set Cache-Control "public, max-age=2592000"
	</FilesMatch>
</IfModule>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 4. Nginx配置

# 4.1 Nginx Settings

# Proxy mode

Nginx proxies requests to Apache. Turn off to stop using Apache.

功能说明:Nginx 代理请求到 Apache。关闭此选项将停止使用 Apache。

On

# Smart static files processing

If turned off, Apache will process all requests for static files. nginx will only pass requests and responses without modification. Turn off this option only for troubleshooting.

功能说明:如果关闭此选项,Apache 将处理所有静态文件的请求,而 Nginx 只会传递请求和响应而不进行修改。仅在故障排除时关闭此选项。

On

# Serve static files directly by nginx

Specify file extensions separated by spaces or by the "|" symbol. Requests for these files will be handled by nginx and never reach Apache. Caution: Apache rewrite rules will not be applied.

功能说明:指定用空格或 "|" 符号分隔的文件扩展名。这些文件的请求将由 Nginx 处理,永远不会到达 Apache。注意:Apache 的重写规则将不适用于这些文件。

ac3 avi bmp bz2 css cue dat doc docx dts eot exe flv gif gz htm html ico img iso jpeg jpg js mkv mp3 mp4 mpeg mpg ogg pdf png ppt pptx qt rar rm svg swf tar tgz ttf txt wav woff woff2 xls xlsx zip webp
1

# Maximum allowed HTTP request body size

Requests with body above the limit will be discarded with HTTP 413 Payload Too Large (configures the "client_max_body_size" nginx directive value).

功能说明:超过限制的请求将被丢弃,并返回 HTTP 413 Payload Too Large 错误(配置 nginx 指令 "client_max_body_size" 的值)。

推荐设置为 128MB,根据实际需求调整。

128MB

# Enable nginx caching

Caching may reduce website response time and server load, but should be used with care.

功能说明:启用 Nginx 缓存可能会减少网站响应时间和服务器负载,但应谨慎使用。

On

# Cache size

设置缓存大小,推荐设置为 256MB,根据服务器资源和网站需求调整。(通常设置为服务器内存的 1/4 或更高, 大的电商网站适当增加到 512MB~ 1GB)。

256MB

# Cache timeout

设置缓存过期时间,推荐设置为 60 minutes,根据网站内容更新频率调整。

60 minutes

# Cache key

设置缓存键,推荐使用 $scheme$request_method$host$request_uri,确保不同协议、请求方法、主机和 URI 的请求被正确缓存。

$scheme$request_method$host$request_uri

#Wordpress#Plesk Hosting#项目优化
上次更新: 2026/03/07, 05:02:43
Wordpress质量检测

← Wordpress质量检测

最近更新
01
单节点 Hysteria2 + Clash Verge Rev 配置教程
05-28
02
服务器防火墙UFW
04-03
03
MacOS低配置关闭系统特效
03-22
更多文章>
Theme by Vdoing | Copyright © 2019-2026 Ji Fu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式