Я пытаюсь загрузить файл на свой сервер, используя запрос POST, и он продолжает выдавать мне ошибку отказа в соединении.
Я пробовал поискать в Google, но все, что я могу найти об этомэто не исправить.
Сообщение об ошибке:
2019/05/04 15:42:50 [notice] 7033#7033: signal process started
2019/05/04 15:42:59 [error] 7034#7034: *46 connect() failed (111: Connection refused) while connecting to upstream, client: XXX.XXX.XX.XX, server: , request: "POST /upload HTTP/1.1", upstream: "http://127.0.0.1:8080/upload", host: "XX.XX.XXX.XX", referrer: "http://XX.XX.XXX.XX/"
Мой .conf файл:
server {
client_max_body_size 100m;
listen 80;
# Upload form should be submitted to this location
location /upload {
# Pass altered request body to this location
upload_pass @test;
# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
upload_store /usr/share/nginx/html/upload/ 1;
# Allow uploaded files to be read only by user
upload_store_access user:rw;
# Set specified fields in request body
upload_set_form_field $upload_field_name.name "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";
# Inform backend about hash and size of a file
upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
upload_pass_form_field "^submit$|^description$";
upload_cleanup 400 404 499 500-505;
}
# Pass altered request body to a backend
location @test {
proxy_pass http://127.0.0.1:8080;
}
}
Мой файл index.html
<html>
<head>
<title>Test upload</title>
</head>
<body>
<h2>Select files to upload</h2>
<form name="upload" method="POST" enctype="multipart/form-data" action="/upload">
<input type="file" name="file1"><br>
<input type="submit" name="submit" value="Upload">
<input type="hidden" name="test" value="value">
</form>
</body>
</html>
Он должен загрузить файл в / usr / share / nginx / html / upload / 1 / Он просто дает мне 502 плохой шлюз и не загружает файл.