nginx上传文件

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>uploadTesttitle>
head>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<form name="upload" method="POST" enctype="multipart/form-data" action="http://192.168.203.130:8082/upload">
<input type="file" name="file">
<input type="submit" name="submit" value="Upload">
form>
body>
html>
View Code

nginx上传文件_第1张图片

create失败,upload_store_access全部加rw权限也不行。
联想到root账号也不能ssh登陆,猜测是提交上传的请求无法在/root目录下生成文件。于是抱着试一试的心态把上传目录upload_store改为子帐号下。哈哈
nginx上传文件_第2张图片

root@liuhan888:~/nginx/sbin# ./nginx -s reload
重启nginx,
重新提交,ok了。呵呵

 

nginx上传文件_第3张图片
由于选择multipart/form-data模式上传,浏览器会自动在文件内容间加上分隔符bound。
前面curl的笔记有详细观察记录。nginx后面会把分隔符去掉取文件内容保存。

转载于:https://www.cnblogs.com/liuhan333/p/5682095.html

你可能感兴趣的:(nginx上传文件)