[+] Add example config

This commit is contained in:
Azalea Gui
2023-02-11 16:43:39 -05:00
parent d861897be8
commit 782e1d7125
4 changed files with 53 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
### Nginx Examples
Here are some of the example configurations using this module:
* [arch.nginx.conf](./arch.nginx.conf): ArchLinux repository server
* [example.nginx.conf](./example.nginx.conf): A made-up example config
+45
View File
@@ -0,0 +1,45 @@
# arch.hydev.org ArchLinux repository server
server
{
listen 443 ssl;
listen [::]:443 ssl;
server_name arch.hydev.org;
root /data/OS/ArchMirror/RISCV;
# Serve a different file for your home page (if you want one)
location = / {
index extra/index.html;
}
# If no file is found on any path, serve meowindex
location ^~ / {
try_files $uri /__meowindex__/index.html;
}
# The api block
location ^~ /api {
alias /data/OS/ArchMirror/RISCV;
index DISABLE_INDEX_HTML_AUTO_MATCHING;
autoindex on;
autoindex_format json;
add_header Access-Control-Allow-Origin *;
}
# The MeowIndex web app block
location ^~ /__meowindex__ {
alias /etc/nginx/MeowIndex/dist;
sub_filter_types application/javascript;
sub_filter_once off;
sub_filter "{DEPLOY-PATH-PLACEHOLDER}" "/__meowindex__";
sub_filter "{HOST-PLACEHOLDER}" "/api";
sub_filter "\"/assets" "\"/__meowindex__/assets";
try_files $uri /__meowindex__/index.html;
}
ssl_certificate /etc/letsencrypt/live/arch.hydev.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/arch.hydev.org/privkey.pem;
}
+44
View File
@@ -0,0 +1,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;
}