summaryrefslogtreecommitdiffstats
path: root/software/nginx.page
blob: 2bd3d9787666f50c6d9b91b23771c7dd3b7b9dc7 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

Here are some templates for reverse-proxy + wildcard SSL hosting.

/etc/nginx/sites-enabled/default:

    server {
            listen   80 default; ## listen for ipv4; this line is default and implied
            listen   [::]:80 default ipv6only=on; ## listen for ipv6
    
            access_log  /var/log/nginx/access.log;
    
            location / {
                    root /srv/http/default/www;
                    index  index.html index.htm feed.xml;
            }
    
            # redirect server error pages to the static page /50x.html, /404.html
            error_page  404  /404.html;
            error_page   500 502 503 504  /50x.html;
            location = /404.html {
                    root   /srv/http/default/www;
            }
            location = /50x.html {
                    root   /srv/http/default/www;
            }
    }
    
    server {
        listen 443;
        listen [::]:443 ipv6only=on;
        server_name *.YOURDOMAIN.HERE;
    
        ssl on;
        ssl_certificate /etc/ssl/certs/YOUR_CERT_HERE.combined.crt;
        ssl_certificate_key /etc/ssl/private/YOUR_KEY_HERE.key;
    
        location / {
            proxy_pass http://localhost:80/;
            proxy_set_header host $host;
        }
    }

/etc/nginx/sites-available/example_static:


    server {
            listen   80; ## listen for ipv4; this line is default and implied
            listen   [::]:80; ## listen for ipv6
            server_name STATIC.YOURDOMAIN.HERE;

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

            location / {
                    root /srv/http/YOUR_STATIC_PATH_HERE;
                    #index  index.html index.htm;
                    autoindex on;
                    #autoindex_exact_size off;
            }

            location /SOME_USER {
                    alias /home/SOME_USER/www;
                    index  index.html index.htm;
                    autoindex on;
            }
    }

/etc/nginx/sites-available/example_proxy:


    server {
            listen   80; ## listen for ipv4; this line is default and implied
            listen   [::]:80; ## listen for ipv6
            server_name mailman mailman.YOUR_DOMAIN.HERE;

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

            location = / {
                    rewrite ^ /mailman/listinfo permanent;
            }

            location / {
                    rewrite ^ /mailman$uri?$args;
            }

            location /mailman/ {
                    include proxy_params;
                    proxy_pass http://127.0.0.1:5001/;
                    proxy_set_header Host $host;
                    proxy_set_header X-Real-IP $remote_addr;
            }
    }