mirror of https://github.com/YGGverse/YGGbro.git
ghost
9 months ago
6 changed files with 142 additions and 1 deletions
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
# Nginx proxy configuration for mentallandscape.com.bro.ygg |
||||
|
||||
Current implementation drops all JS and forward links to following locations: |
||||
|
||||
* `mentallandscape.com` > `mentallandscape.com.bro.ygg` |
||||
|
||||
## Install |
||||
|
||||
* `ln -s /etc/yggbro/nginx/mentallandscape.com/mentallandscape.com.bro.ygg/server.conf /etc/nginx/sites-enabled/yggbro.mentallandscape.com.mentallandscape.com.bro.ygg.conf` |
||||
* `nginx -t` |
||||
* `service nginx reload` |
||||
|
||||
## Uninstall |
||||
|
||||
* `rm /etc/nginx/sites-enabled/yggbro.mentallandscape.com.mentallandscape.com.bro.ygg.conf` |
||||
* `nginx -t` |
||||
* `service nginx reload` |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
server { |
||||
|
||||
# HTTP/IPv6 only |
||||
listen [::]:80; |
||||
|
||||
# Yggdrasil only |
||||
allow 0200::/7; |
||||
deny all; |
||||
|
||||
server_name mentallandscape.com.bro.ygg; |
||||
|
||||
location / { |
||||
|
||||
# Forward to server |
||||
proxy_pass http://mentallandscape.com/; |
||||
|
||||
# Tell to server, that's proxy request |
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||
proxy_set_header X-Real-IP $remote_addr; |
||||
|
||||
# Replace links |
||||
sub_filter_once off; |
||||
sub_filter_types *; |
||||
|
||||
sub_filter 'http://mentallandscape.com' 'http://mentallandscape.com.bro.ygg'; |
||||
sub_filter 'https://mentallandscape.com' 'http://mentallandscape.com.bro.ygg'; |
||||
sub_filter '<script' '<!-- <script'; |
||||
sub_filter '</script>' '</script> -->'; |
||||
sub_filter 'href="/support/"' 'href="https://mentallandscape.com/p/support"'; |
||||
sub_filter 'href="/' 'href="http://mentallandscape.com.bro.ygg/'; |
||||
sub_filter 'src="/' 'src="http://mentallandscape.com.bro.ygg/'; |
||||
sub_filter 'data-src="/' 'src="http://mentallandscape.com.bro.ygg/'; |
||||
sub_filter "url('/" "url('http://mentallandscape.com.bro.ygg/"; |
||||
|
||||
# Feedback link to project repository |
||||
sub_filter '</body>' '<a style="position:fixed;top:20px;right:20px;z-index:999" href="https://github.com/YGGverse/YGGbro/tree/main/nginx/mentallandscape.com/mentallandscape.com.bro.ygg" target="_blank">YGGbro</a></body>'; |
||||
} |
||||
} |
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
# Nginx proxy configuration for /yggbro/mentallandscape.com subfolder location |
||||
|
||||
Current implementation drops all JS and forward links to following locations: |
||||
|
||||
* `mentallandscape.com` > `/yggbro/mentallandscape.com` |
||||
|
||||
## Install |
||||
|
||||
This is subfolder configuration, use `server.conf` preset only when `default_server` not defined in your system: |
||||
|
||||
* `ln -s /etc/yggbro/nginx/mentallandscape.com/yggbro/mentallandscape.com/server.conf /etc/nginx/sites-enabled/yggbro.mentallandscape.com.yggbro.mentallandscape.com.conf` |
||||
|
||||
Alternatively, add following line to existing `default_server`: |
||||
|
||||
``` |
||||
include /etc/yggbro/nginx/mentallandscape.com/yggbro/mentallandscape.com/location.conf; |
||||
``` |
||||
|
||||
Test configuration and apply changes |
||||
|
||||
* `nginx -t` |
||||
* `service nginx reload` |
||||
|
||||
## Uninstall |
||||
|
||||
Remove symlink if exists: |
||||
|
||||
* `rm /etc/nginx/sites-enabled/yggbro.mentallandscape.com.yggbro.mentallandscape.com.conf` |
||||
|
||||
Remove following line from existing `default_server`: |
||||
|
||||
``` |
||||
include /etc/yggbro/nginx/mentallandscape.com/yggbro/mentallandscape.com/location.conf; |
||||
``` |
||||
|
||||
Test configuration and apply changes |
||||
|
||||
* `nginx -t` |
||||
* `service nginx reload` |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
location /yggbro/mentallandscape.com { |
||||
|
||||
# Forward to server |
||||
proxy_pass http://mentallandscape.com/; |
||||
|
||||
# Tell to server, that's proxy request |
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||
proxy_set_header X-Real-IP $remote_addr; |
||||
|
||||
# Replace links |
||||
sub_filter_once off; |
||||
sub_filter_types *; |
||||
|
||||
sub_filter 'http://mentallandscape.com' 'http://[$server_addr]/yggbro/mentallandscape.com'; |
||||
sub_filter 'https://mentallandscape.com' 'http://[$server_addr]/yggbro/mentallandscape.com'; |
||||
sub_filter '<script' '<!-- <script'; |
||||
sub_filter '</script>' '</script> -->'; |
||||
sub_filter 'href="/support/"' 'href="https://mentallandscape.com/p/support"'; |
||||
sub_filter 'href="/' 'href="http://[$server_addr]/yggbro/mentallandscape.com/'; |
||||
sub_filter 'src="/' 'src="http://[$server_addr]/yggbro/mentallandscape.com/'; |
||||
sub_filter 'data-src="/' 'src="http://[$server_addr]/yggbro/mentallandscape.com/'; |
||||
sub_filter "url('/" "url('http://[$server_addr]/yggbro/mentallandscape.com/"; |
||||
|
||||
# Feedback link to project repository |
||||
sub_filter '</body>' '<a style="position:fixed;top:20px;right:20px;z-index:999" href="https://github.com/YGGverse/YGGbro/tree/main/nginx/mentallandscape.com/yggbro/mentallandscape.com" target="_blank">YGGbro</a></body>'; |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
server { |
||||
|
||||
# HTTP/IPv6 connections only |
||||
listen [::]:80 default_server; # make sure default_server not exists or throw an exception |
||||
|
||||
# Yggdrasil connections only |
||||
allow 0200::/7; |
||||
deny all; |
||||
|
||||
# Listen defaults |
||||
server_name _; |
||||
|
||||
# Include available locations |
||||
include /etc/yggbro/nginx/mentallandscape.com/yggbro/mentallandscape.com/location.conf; |
||||
} |
Loading…
Reference in new issue