Browse Source

thumbor-nginx-cors

pull/7/head
Johannes Schickling 9 years ago
parent
commit
a744d92ba1
  1. 1
      README.md
  2. 4
      thumbor-nginx-cors/Dockerfile
  3. 3
      thumbor-nginx-cors/README.md
  4. 75
      thumbor-nginx-cors/nginx.conf

1
README.md

@ -20,6 +20,7 @@ Collection of lightweight and ready-to-use docker images
* **[Rust](https://github.com/schickling/dockerfiles/tree/master/rust)** - Lightweight nightly Rust build including Cargo and GDB * **[Rust](https://github.com/schickling/dockerfiles/tree/master/rust)** - Lightweight nightly Rust build including Cargo and GDB
* **[swagger-ui](https://github.com/schickling/dockerfiles/tree/master/swagger-ui)** - Swagger UI 2.1.2 with API_URL and API_KEY injection (45 MB) * **[swagger-ui](https://github.com/schickling/dockerfiles/tree/master/swagger-ui)** - Swagger UI 2.1.2 with API_URL and API_KEY injection (45 MB)
* **[s3cmd](https://github.com/schickling/dockerfiles/tree/master/s3cmd)** - Lightweight wrapper around s3cmd * **[s3cmd](https://github.com/schickling/dockerfiles/tree/master/s3cmd)** - Lightweight wrapper around s3cmd
* **[thumbor-nginx-cors](https://github.com/schickling/dockerfiles/tree/master/thumbor-nginx-cors)** - Nginx image for thumbor with CORS support
## FAQ ## FAQ

4
thumbor-nginx-cors/Dockerfile

@ -0,0 +1,4 @@
FROM nginx:1.9
MAINTAINER Johannes Schickling "schickling.j@gmail.com"
COPY nginx.conf /etc/nginx/

3
thumbor-nginx-cors/README.md

@ -0,0 +1,3 @@
# thumbor-nginx-cors
Nginx image for thumbor with CORS support (based on [APSL/docker-thumbor](https://github.com/APSL/docker-thumbor))

75
thumbor-nginx-cors/nginx.conf

@ -0,0 +1,75 @@
user nginx;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
port_in_redirect on;
server_names_hash_bucket_size 128;
server_name_in_redirect off;
client_max_body_size 60m;
include /etc/nginx/mime.types;
default_type application/octet-stream;
send_timeout 300;
client_body_timeout 300;
client_header_timeout 300;
access_log /logs/access.log;
error_log /logs/error.log;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
upstream thumbor {
server thumbor:80;
}
server {
listen 80 default;
server_name localhost;
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With';
if ($request_method = 'OPTIONS') {
return 204;
}
location ~* "^/(..)(..)(.+)?$" {
root /data/result_storage/v2/$1/$2;
expires 1M;
error_page 404 = @fetch;
}
location @fetch {
internal;
proxy_pass http://thumbor$request_uri;
}
location ~ /\.ht { deny all; }
location ~ /\.hg { deny all; }
location ~ /\.svn { deny all; }
}
}
Loading…
Cancel
Save