-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.nginx.conf
44 lines (36 loc) · 1.09 KB
/
example.nginx.conf
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
# HTTPS
server {
listen 443 ssl;
listen [::]:443 ssl;
# Don't forget to set your domain name here
server_name example.com;
# You can generate SSL certificates for nginx using certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# The api block
location ^~ /api {
# The path to your static file server
alias "/data/file-server";
autoindex on;
autoindex_format json;
add_header Access-Control-Allow-Origin *;
}
# The MeowIndex web app block
location ^~ / {
alias /etc/nginx/MeowIndex/dist;
# Use sub_filter to configure the app
sub_filter_types application/javascript;
sub_filter_once on;
sub_filter "{HOST-PLACEHOLDER}" "/api";
# Serve index.html on other 404 paths as well
try_files $uri $uri/ /index.html;
}
}
# Redirect HTTP to HTTPS
server
{
listen 80 default_server;
listen [::]:80 default_server;
server_name default;
return 302 https://$host$request_uri;
}