-
Notifications
You must be signed in to change notification settings - Fork 0
/
default
70 lines (52 loc) · 2.69 KB
/
default
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
58
59
60
61
62
63
64
65
66
67
68
69
70
# Let's redirect all unencrypted traffic to TLS:
server {
listen 80 default_server;
return 301 https://$host$request_uri;
}
server {
# The default_server parameter, if present, will cause the server to become the default server for the specified address:port pair.
listen 443 ssl;
server_name ansibledest.local;
# You can generate your own self-signed tls certs with the following:
# sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
# the self-signed.conf points to the key & crt you created in the openssl command above! ssl-params is just tls security settings needed by Tokumei
include snippets/self-signed.conf;
include snippets/ssl-params.conf;
client_max_body_size 100M; #Tokumei setting for max file uploads to the anon board.
root /var/www/ansibledest.local/sites/\$host/;
index index.html;
location /offgrid {
#return 200 'location 2'; # If you ever doubt that a location is firing, you can use this command to debug and confirm it!
# This is how I made the directory listing of mp3s downloadable, while rtf's get rendered.
types {
application/octet-stream mp3;
text/plain rtf;
application/pdf pdf;
}
alias /var/www/ansibledest.local/offgrid; #this is how I set the offgrid location outside of the normal stuff.
try_files $uri =404;
#this if was a cool way to prove that I could add different headers for file types. Totally not needed at this time.
if ( $request_filename ~ "^.*/(.+\.(mp3|pdf|mp4))$" ){
set $fname $1;
add_header Content-Disposition 'attachment; filename="$fname"';
add_header Test test;
}
}
location / {
try_files $uri uri/ @werc; # first, try the uri submitted by the user. next, search the uri/ directory under root. finally, give up and go the the @werc location for processing.
}
location /pub/ {
root /var/www/ansibledest.local;
try_files $uri =404;
}
location = /favicon.ico {
root /var/www/ansibledest.local;
try_files /var/www/ansibledest.local/sites\/$host\/$uri /pub/default_favicon.ico =404;
}
error_page 404 = @werc;
# The “@” prefix defines a named location. Such a location is not used for a regular request processing, but instead used for request redirection. They cannot be nested, and cannot contain nested locations.
location @werc {
include fastcgi_params; # located in /etc/nginx/
fastcgi_pass localhost:3333; # send traffic to our gcd server, which is invoked with # sudo /usr/local/go/bin/cgd -f -c /var/www/ansibledest.local/bin/werc.rc > /dev/null 2>&1 &
}
}