added nginx variable option
parent
b3e7c01150
commit
512317017f
65
Setup.md
65
Setup.md
@ -5,6 +5,7 @@
|
|||||||
<li><a href="#subfilter-method">Subfilter Method</a>
|
<li><a href="#subfilter-method">Subfilter Method</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#nginx">Nginx</a></li>
|
<li><a href="#nginx">Nginx</a></li>
|
||||||
|
<li><a href="#nginx-variable">Nginx Variable</a></li>
|
||||||
<li><a href="#apache-untested">Apache</a></li>
|
<li><a href="#apache-untested">Apache</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -60,6 +61,70 @@ location /sonarr {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Nginx Variable
|
||||||
|
|
||||||
|
You can also setup Nginx to use variables to change the themes. This will update the theme on all your location blocks by just changing 1 variable. This is nice if you quickly want to change colors on all of your apps.
|
||||||
|
|
||||||
|
#### http block
|
||||||
|
|
||||||
|
In you http block add the following:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
# THEME.PARK
|
||||||
|
map $host $theme {
|
||||||
|
default <theme>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Change `<theme>` to the theme you want on all your apps. e.g. `default dark;`
|
||||||
|
|
||||||
|
Available themes are:
|
||||||
|
`aquamarine`
|
||||||
|
`hotline`
|
||||||
|
`plex`
|
||||||
|
`dark`
|
||||||
|
`space-gray`
|
||||||
|
|
||||||
|
#### theme-park.conf
|
||||||
|
Next create a new file called `theme-park.conf` and add the following code: (Note: It's not really necessary to create the conf file but I think it looks cleaner in the location blocks)
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
proxy_set_header Accept-Encoding "";
|
||||||
|
sub_filter
|
||||||
|
'</head>'
|
||||||
|
'<link rel="stylesheet" type="text/css" href="https://gilbn.github.io/theme.park/CSS/themes/$app/$theme.css">
|
||||||
|
</head>';
|
||||||
|
sub_filter_once on;
|
||||||
|
```
|
||||||
|
As you can see the URL has variables in it `/$app/$theme.css`
|
||||||
|
The `$theme` variable is set in the http block and will affect all server blocks. And the `$app` variable is set in the location block.
|
||||||
|
|
||||||
|
#### location blocks
|
||||||
|
|
||||||
|
Now in the location block use the include syntax and include the theme-park.conf file and set the $app variable, like so:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
set $app sonarr;
|
||||||
|
include /config/nginx/theme-park.conf;
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```nginx
|
||||||
|
location /sonarr {
|
||||||
|
proxy_pass http://192.168.1.34:8990/sonarr;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_no_cache $cookie_session;
|
||||||
|
set $app sonarr;
|
||||||
|
include /config/nginx/theme-park.conf;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Now when you change the variable in the http block and restart nginx, it will update the theme for all your apps!
|
||||||
|
|
||||||
### Apache (Untested)
|
### Apache (Untested)
|
||||||
```apache
|
```apache
|
||||||
AddOutputFilterByType SUBSTITUTE text/html
|
AddOutputFilterByType SUBSTITUTE text/html
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user