Increase HTTP MaxBodySize (for file uploads)

This commit is contained in:
Fergal Moran
2018-04-21 07:29:57 +01:00
parent fcb671de39
commit 66b10579c7
3 changed files with 44 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ server {
if ($ssl_protocol = "") { if ($ssl_protocol = "") {
rewrite ^((?!/rss/).) https://$server_name$request_uri? permanent; rewrite ^((?!/rss/).) https://$server_name$request_uri? permanent;
} }
location ~* \.(eot|otf|ttf|woff|woff2)$ { location ~* \.(eot|otf|ttf|woff|woff2)$ {
root /usr/share/nginx/html; root /usr/share/nginx/html;
} }
location /assets/ { location /assets/ {
@@ -57,6 +57,9 @@ server {
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
if ($ssl_protocol = "") { if ($ssl_protocol = "") {
rewrite ^((?!/rss/).) https://$server_name$request_uri? permanent; rewrite ^((?!/rss/).) https://$server_name$request_uri? permanent;
} }
@@ -64,6 +67,8 @@ server {
location / { location / {
proxy_pass http://api:5000/; proxy_pass http://api:5000/;
client_max_body_size 30000M;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Connection $http_connection; proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;

View File

@@ -1,14 +1,31 @@
FROM microsoft/dotnet-nightly:2.1.0-preview1-runtime-alpine FROM microsoft/dotnet:2.1.300-preview2-sdk-alpine AS build
COPY out/* /app/
WORKDIR /app WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore
# copy everything else and build app
COPY . .
WORKDIR /app/
RUN dotnet build
FROM build AS publish
WORKDIR /app
RUN dotnet publish -c Release -o out
FROM microsoft/dotnet:2.1.0-preview2-aspnetcore-runtime-alpine AS runtime
WORKDIR /app
COPY --from=publish /app/out ./
# ln -s /usr/lib/libuv.so.1 /usr/lib/libuv.so && \
RUN apk add --no-cache --update \ RUN apk add --no-cache --update \
python \ python \
ffmpeg \ ffmpeg \
libuv \ libuv \
curl \ curl \
curl-dev && \ curl-dev && \
ln -s /usr/lib/libuv.so.1 /usr/lib/libuv.so && \
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \ curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \
chmod a+rx /usr/local/bin/youtube-dl && \ chmod a+rx /usr/local/bin/youtube-dl && \
youtube-dl -U youtube-dl -U

View File

@@ -9,25 +9,31 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace PodNoms.Api { namespace PodNoms.Api
public class Program { {
public class Program
{
static bool isDevelopment = static bool isDevelopment =
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == EnvironmentName.Development; Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == EnvironmentName.Development;
public static void Main(string[] args) { public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run(); CreateWebHostBuilder(args).Build().Run();
} }
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.UseUrls("http://0.0.0.0:5000"); .UseUrls("http://0.0.0.0:5000")
// .UseKestrel(options => { .UseKestrel(options =>
// options.Listen(IPAddress.Any, 5000); {
// if (isDevelopment){ options.Limits.MaxRequestBodySize = 1073741824; //1Gb
// options.Listen(IPAddress.Any, 5001, listenOptions => { // if (isDevelopment)
// listenOptions.UseHttps("certs/dev2.podnoms.com.pfx", "secret"); // {
// }); // options.Listen(IPAddress.Any, 5001, listenOptions =>
// } // {
// }); // listenOptions.UseHttps("certs/dev2.podnoms.com.pfx", "secret");
// });
// }
});
} }
} }