Web server implemented to upload, download and delete image using NGINX and FASTCGI scripts
Run media service containers through docker-compose command. The 8888 port allows you to access the media server process.
In the first run, enter the command with the add --build option to docker-compose up to run the container after building the image.
$ cd common
$ cd MediaService
$ docker-compose up --build # 최초 실행 시 --build 옵션 추가 If you have an existing image, it runs through docker-compose up .
$ cd common
$ cd MediaService
$ docker-compose up If you want to change the media service port, change MEDIA_PORT port value of the .env file.
Request for uploading images.
Request
Content-Type : multipart/form-dataResponse
Normal processing
{
"code" : 200 ,
"message" : " File(s) successfully uploaded. " ,
"data" : {
"file_name" : " bts_jk.gif " ,
"file_id" : " b7436194d5034bb69767688807393e48 "
}
}error
When the image is not sent
If the body is empty: Nginx 400 BAD Request
< html >
< head >
< title > 404 Not Found </ title >
</ head >
< body >
< center >
< h1 > 404 Not Found </ h1 >
</ center >
< hr >
< center > nginx/1.20.2 </ center >
</ body >
</ html >If there is a body but not a file type
{
"code" : 400 ,
"message" : " No file received. "
}If the size of the image file you want to upload is too large: Nginx 413 Request Too Large error
< html >
< head >
< title > 413 Request Entity Too Large </ title >
</ head >
< body >
< center >
< h1 > 413 Request Entity Too Large </ h1 >
</ center >
< hr >
< center > nginx/1.20.2 </ center >
</ body >
</ html >If several images are uploaded
{
"code" : 400 ,
"message" : " Multiple file upload not allowed. "
}If the uploaded image is not allowed
{
"code" : 400 ,
"message" : " File extension of file webp_jk.webp not allowed. "
}Request an image multiple upload.
Request
Content-Type : multipart/form-dataResponse
Normal processing
{
"code" : 200 ,
"message" : " File(s) successfully uploaded. " ,
"data" : [
{
"file_name" : " jpeg_jk3.jpg " ,
"file_id" : " b3b2bc5b075f434692f71657afbae2c9 "
},
{
"file_name" : " png_jk.png " ,
"file_id" : " 20995dfcf94a49e7b6d34ccce744609c "
},
{
"file_name" : " png_bts.png " ,
"file_id" : " 9d15ce7799dd499181bbc8cace4761b7 "
},
{
"file_name" : " jpg_cat.jpg " ,
"file_id" : " 5fd0f71238ed4086b9bb58859ac3b271 "
}
]
}error
When the image is not sent: Post Images/Upload
If one image is uploaded
{
"code" : 400 ,
"message" : " Single file upload not allowed. "
}If one of the uploaded images is an extension that is not allowed
{
"code" : 400 ,
"message" : " File extension of file webp_jk.webp not allowed. "
}If the size of the image file you want to upload is too large: Nginx 413 Request Too Large error
< html >
< head >
< title > 413 Request Entity Too Large </ title >
</ head >
< body >
< center >
< h1 > 413 Request Entity Too Large </ h1 >
</ center >
< hr >
< center > nginx/1.20.2 </ center >
</ body >
</ html >Request an image file.
error
If there is no image file you want to find
< html >
< head >
< title > 404 Not Found </ title >
</ head >
< body >
< center >
< h1 > 404 Not Found </ h1 >
</ center >
< hr >
< center > nginx/1.20.2 </ center >
</ body >
</ html >Request for deleting image files.
Normal processing
{
"code" : 200 ,
"message" : " File 20995dfcf94a49e7b6d34ccce744609c successfully deleted. "
}error
If there is no image file to be deleted
{
"code" : 400 ,
"message" : " File 20995dfcf94a49e7b6d34ccce744609c does not exists. "
}