feat(server): 增加服务器配置和错误页面处理
增加请求体大小限制至500MB并添加自定义PHP配置 添加404和500错误页面 设置PHP文件上传和错误日志相关参数
This commit is contained in:
@@ -1 +1,6 @@
|
||||
LimitRequestBody 10485760
|
||||
# 增加请求体大小限制
|
||||
LimitRequestBody 524288000
|
||||
|
||||
# 错误处理
|
||||
ErrorDocument 500 /error_pages/500.html
|
||||
ErrorDocument 404 /error_pages/404.html
|
||||
23
error_pages/404.html
Normal file
23
error_pages/404.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>404 - 页面未找到</title>
|
||||
<link href="/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f8f9fa; }
|
||||
.error-container { text-align: center; padding: 2rem; background-color: white; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
|
||||
h1 { font-size: 5rem; margin: 0; color: #6c757d; }
|
||||
p { font-size: 1.2rem; margin: 1rem 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<h1>404</h1>
|
||||
<h2>页面未找到</h2>
|
||||
<p>您请求的页面不存在或已被移动。</p>
|
||||
<a href="/" class="btn btn-primary mt-3">返回首页</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
24
error_pages/500.html
Normal file
24
error_pages/500.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>500 - 服务器内部错误</title>
|
||||
<link href="/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f8f9fa; }
|
||||
.error-container { text-align: center; padding: 2rem; background-color: white; border-radius: 10px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
|
||||
h1 { font-size: 5rem; margin: 0; color: #dc3545; }
|
||||
p { font-size: 1.2rem; margin: 1rem 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<h1>500</h1>
|
||||
<h2>服务器内部错误</h2>
|
||||
<p>服务器遇到意外错误,无法完成您的请求。</p>
|
||||
<p>我们的技术团队已收到通知,正在处理此问题。</p>
|
||||
<a href="/" class="btn btn-primary mt-3">返回首页</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
24
php.ini
Normal file
24
php.ini
Normal file
@@ -0,0 +1,24 @@
|
||||
; 自定义PHP配置文件 - 用于大型文件上传
|
||||
|
||||
[PHP]
|
||||
; 上传文件大小限制
|
||||
upload_max_filesize = 500M
|
||||
; POST数据大小限制
|
||||
post_max_size = 500M
|
||||
; 脚本最大执行时间(秒)
|
||||
max_execution_time = 300
|
||||
; 输入数据解析时间限制
|
||||
max_input_time = 300
|
||||
; 内存限制
|
||||
memory_limit = 256M
|
||||
|
||||
; 错误日志设置
|
||||
log_errors = On
|
||||
error_log = "php_errors.log"
|
||||
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
||||
|
||||
; 文件上传临时目录
|
||||
; upload_tmp_dir = "C:\temp\php_uploads"
|
||||
|
||||
[Date]
|
||||
date.timezone = Asia/Shanghai
|
||||
Reference in New Issue
Block a user