aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mediagoblin/templates/etc_nginx_sites-available_mediagoblin.j2
blob: dad976c9d71d90fa80cb4c46c0bd17c0200a9047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# {{ ansible_managed }}

server {

    listen 80;
    listen [::]:80;
    server_name {{ mediagoblin_hostname }};

    # Change this to update the upload size limit for your users
    client_max_body_size 8m;

    # prevent attacks (someone uploading a .txt file that the browser
    # interprets as an HTML file, etc.)
    add_header X-Content-Type-Options nosniff;

    access_log /var/log/nginx/mediagoblin.access.log;
    error_log /var/log/nginx/mediagoblin.error.log;

    # MediaGoblin's stock static files: CSS, JS, etc.
    location /mgoblin_static/ {
        alias {{ mediagoblin_basedir }}/src/mediagoblin/static/;
    }

    # Instance specific media:
    location /mgoblin_media/ {
        alias {{ mediagoblin_basedir }}/data/media/public/;
    }

    # Theme static files (usually symlinked in)
    location /theme_static/ {
        alias {{ mediagoblin_basedir }}/src/user_dev/theme_static/;
    }

    # Plugin static files (usually symlinked in)
    location /plugin_static/ {
        alias {{ mediagoblin_basedir }}/src/user_dev/plugin_static/;
    }

#    # Mounting MediaGoblin itself via FastCGI.
#    location / {
#        fastcgi_pass 127.0.0.1:26543;
#        include /etc/nginx/fastcgi_params;
#
#        # our understanding vs nginx's handling of script_name vs
#        # path_info don't match :)
#        fastcgi_param PATH_INFO $fastcgi_script_name;
#        fastcgi_param SCRIPT_NAME "";
#    }

    # Until FastCGI works, just do a proxy pass
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://127.0.0.1:26543;
    }
}