【发布时间】:2021-02-23 14:47:44
【问题描述】:
我有一个简单的 html 表单,可以将 .xlsx 文件上传到网络服务器。它在本地主机中运行良好,但在亚马逊 AWS 中却不行。提交表单后出现 500 内部服务器错误。
在 /etc/httpd/conf/httpd.conf 下添加 mime 类型行并重新启动 apache 网络服务器
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
但仍然报 500 内部服务器错误。
访问日志
106.193.45.134 - - [11/Nov/2020:20:10:15 +0000] "GET /assets/google-fonts/nunito.css HTTP/1.1" 404 196 "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/exams" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:10:15 +0000] "GET /admin/assets/images/logo.png HTTP/1.1" 404 196 "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/exams" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:10:21 +0000] "GET /admin/add-questions?node=EX-803724 HTTP/1.1" 200 33642 "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/exams" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:10:21 +0000] "GET /assets/google-fonts/nunito.css HTTP/1.1" 404 196 "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/add-questions?node=EX-803724" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:10:22 +0000] "GET /assets/js/validation/custom.js HTTP/1.1" 304 - "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/add-questions?node=EX-803724" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:10:22 +0000] "GET /admin/assets/images/logo.png HTTP/1.1" 404 196 "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/add-questions?node=EX-803724" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:10:32 +0000] "POST /admin/app/import-question.php HTTP/1.1" 500 - "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/add-questions?node=EX-803724" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:11:21 +0000] "POST /admin/app/import-question.php HTTP/1.1" 500 - "http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/add-questions?node=EX-803724" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
106.193.45.134 - - [11/Nov/2020:20:12:24 +0000] "-" 408 - "-" "-"
错误日志
[Sun Nov 08 03:28:01.164234 2020] [lbmethod_heartbeat:notice] [pid 11174] AH02282: No slotmem from mod_heartmonitor
[Sun Nov 08 03:28:01.164288 2020] [http2:warn] [pid 11174] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Sun Nov 08 03:28:01.164294 2020] [http2:warn] [pid 11174] AH02951: mod_ssl does not seem to be enabled
[Sun Nov 08 03:28:01.168564 2020] [mpm_prefork:notice] [pid 11174] AH00163: Apache/2.4.46 () configured -- resuming normal operations
[Sun Nov 08 03:28:01.168576 2020] [core:notice] [pid 11174] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon Nov 09 00:37:39.754360 2020] [proxy_fcgi:error] [pid 24378] [client 150.136.192.92:39689] AH01071: Got error 'Primary script unknown\n'
[Tue Nov 10 01:53:56.920943 2020] [proxy_fcgi:error] [pid 24350] [client 106.13.118.194:54806] AH01071: Got error 'Primary script unknown\n'
[Wed Nov 11 13:52:21.182692 2020] [proxy_fcgi:error] [pid 319] [client 169.45.99.50:59122] AH01071: Got error 'Primary script unknown\n'
[Wed Nov 11 13:54:29.578626 2020] [proxy_fcgi:error] [pid 302] [client 169.45.99.50:57770] AH01071: Got error 'Primary script unknown\n'
[Wed Nov 11 13:54:29.579326 2020] [proxy_fcgi:error] [pid 24378] [client 169.45.99.50:57772] AH01071: Got error 'Primary script unknown\n'
[Wed Nov 11 14:42:03.952827 2020] [core:alert] [pid 3857] [client 106.193.45.134:7908] /var/www/html/.htaccess: AddType requires at least two arguments, a mime type followed by one or more file extensions, referer: http://ec2-54-254-14-220.ap-southeast-1.compute.amazonaws.com/admin/add-questions?node=EX-803724
[Wed Nov 11 14:42:11.233041 2020] [core:alert] [pid 25769] [client 106.193.45.134:7909] /var/www/html/.htaccess: AddType requires at least two arguments, a mime type followed by one or more file extensions
[Wed Nov 11 14:42:17.225650 2020] [core:alert] [pid 24330] [client 106.193.45.134:7913] /var/www/html/.htaccess: AddType requires at least two arguments, a mime type followed by one or more file extensions
[Wed Nov 11 15:12:03.140625 2020] [mpm_prefork:notice] [pid 11174] AH00170: caught SIGWINCH, shutting down gracefully
[Wed Nov 11 15:24:56.800211 2020] [suexec:notice] [pid 12386] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Nov 11 15:24:56.816223 2020] [lbmethod_heartbeat:notice] [pid 12386] AH02282: No slotmem from mod_heartmonitor
[Wed Nov 11 15:24:56.816270 2020] [http2:warn] [pid 12386] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Wed Nov 11 15:24:56.816276 2020] [http2:warn] [pid 12386] AH02951: mod_ssl does not seem to be enabled
[Wed Nov 11 15:24:56.818907 2020] [mpm_prefork:notice] [pid 12386] AH00163: Apache/2.4.46 () configured -- resuming normal operations
[Wed Nov 11 15:24:56.818930 2020] [core:notice] [pid 12386] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Nov 11 15:28:05.126291 2020] [mpm_prefork:notice] [pid 12386] AH00170: caught SIGWINCH, shutting down gracefully
[Wed Nov 11 15:28:06.178758 2020] [suexec:notice] [pid 12467] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Nov 11 15:28:06.194217 2020] [lbmethod_heartbeat:notice] [pid 12467] AH02282: No slotmem from mod_heartmonitor
[Wed Nov 11 15:28:06.194265 2020] [http2:warn] [pid 12467] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Wed Nov 11 15:28:06.194277 2020] [http2:warn] [pid 12467] AH02951: mod_ssl does not seem to be enabled
[Wed Nov 11 15:28:06.196829 2020] [mpm_prefork:notice] [pid 12467] AH00163: Apache/2.4.46 () configured -- resuming normal operations
[Wed Nov 11 15:28:06.196853 2020] [core:notice] [pid 12467] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Nov 11 20:04:20.990338 2020] [proxy_fcgi:error] [pid 12468] [client 130.61.96.72:22196] AH01071: Got error 'Primary script unknown\n'
Screenshot headers 由于标题的问题??没有 xlsx mime 类型!!!
【问题讨论】:
-
Apache 和 php 的日志在说什么?
-
发布的访问和错误日志..请检查。
-
还有 php 日志?
-
谢谢 Aleksander Wons,错误是由于 php-xml 包造成的。安装包后它工作正常。
标签: php amazon-web-services amazon-ec2 xlsx