diff --git a/nginx/opennet/README.md b/nginx/opennet/README.md new file mode 100644 index 0000000..e69de29 diff --git a/nginx/opennet/include/locations/include/common.conf b/nginx/opennet/include/locations/include/common.conf new file mode 100644 index 0000000..5a1e0c4 --- /dev/null +++ b/nginx/opennet/include/locations/include/common.conf @@ -0,0 +1,106 @@ +# 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 all matches +sub_filter_once off; + +# Enable multimedia replacement +sub_filter_types *; + +# Disable JS / trackers by default +sub_filter '' ' -->'; + +# Links + +# . +sub_filter 'http://opennet.ru' 'http://[$server_addr]/opennet'; +sub_filter 'https://opennet.ru' 'http://[$server_addr]/opennet'; + +sub_filter 'http://opennet.me' 'http://[$server_addr]/opennet'; +sub_filter 'https://opennet.me' 'http://[$server_addr]/opennet'; + +# www +sub_filter 'http://www.opennet.ru' 'http://[$server_addr]/opennet/www'; +sub_filter 'https://www.opennet.ru' 'http://[$server_addr]/opennet/www'; + +sub_filter 'http://www.opennet.me' 'http://[$server_addr]/opennet/www'; +sub_filter 'https://www.opennet.me' 'http://[$server_addr]/opennet/www'; + +# m +sub_filter 'http://m.opennet.ru' 'http://[$server_addr]/opennet/m'; +sub_filter 'https://m.opennet.ru' 'http://[$server_addr]/opennet/m'; + +sub_filter 'http://m.opennet.me' 'http://[$server_addr]/opennet/m'; +sub_filter 'https://m.opennet.me' 'http://[$server_addr]/opennet/m'; + +# mobile +sub_filter 'http://mobile.opennet.ru' 'http://[$server_addr]/opennet/mobile'; +sub_filter 'https://mobile.opennet.ru' 'http://[$server_addr]/opennet/mobile'; + +sub_filter 'http://mobile.opennet.me' 'http://[$server_addr]/opennet/mobile'; +sub_filter 'https://mobile.opennet.me' 'http://[$server_addr]/opennet/mobile'; + +# wiki +sub_filter 'http://wiki.opennet.ru' 'http://[$server_addr]/opennet/wiki'; +sub_filter 'https://wiki.opennet.ru' 'http://[$server_addr]/opennet/wiki'; + +sub_filter 'http://wiki.opennet.me' 'http://[$server_addr]/opennet/wiki'; +sub_filter 'https://wiki.opennet.me' 'http://[$server_addr]/opennet/wiki'; + +# solaris +sub_filter 'http://solaris.opennet.ru' 'http://[$server_addr]/opennet/solaris'; +sub_filter 'https://solaris.opennet.ru' 'http://[$server_addr]/opennet/solaris'; + +sub_filter 'http://solaris.opennet.me' 'http://[$server_addr]/opennet/solaris'; +sub_filter 'https://solaris.opennet.me' 'http://[$server_addr]/opennet/solaris'; + +# bsd +sub_filter 'http://bsd.opennet.ru' 'http://[$server_addr]/opennet/bsd'; +sub_filter 'https://bsd.opennet.ru' 'http://[$server_addr]/opennet/bsd'; + +sub_filter 'http://bsd.opennet.me' 'http://[$server_addr]/opennet/bsd'; +sub_filter 'https://bsd.opennet.me' 'http://[$server_addr]/opennet/bsd'; + +# cisco +sub_filter 'http://cisco.opennet.ru' 'http://[$server_addr]/opennet/cisco'; +sub_filter 'https://cisco.opennet.ru' 'http://[$server_addr]/opennet/cisco'; + +sub_filter 'http://cisco.opennet.me' 'http://[$server_addr]/opennet/cisco'; +sub_filter 'https://cisco.opennet.me' 'http://[$server_addr]/opennet/cisco'; + +# linux +sub_filter 'http://linux.opennet.ru' 'http://[$server_addr]/opennet/linux'; +sub_filter 'https://linux.opennet.ru' 'http://[$server_addr]/opennet/linux'; + +sub_filter 'http://linux.opennet.me' 'http://[$server_addr]/opennet/linux'; +sub_filter 'https://linux.opennet.me' 'http://[$server_addr]/opennet/linux'; + +# web +sub_filter 'http://web.opennet.ru' 'http://[$server_addr]/opennet/web'; +sub_filter 'https://web.opennet.ru' 'http://[$server_addr]/opennet/web'; + +sub_filter 'http://web.opennet.me' 'http://[$server_addr]/opennet/web'; +sub_filter 'https://web.opennet.me' 'http://[$server_addr]/opennet/web'; + +# security +sub_filter 'http://security.opennet.ru' 'http://[$server_addr]/opennet/security'; +sub_filter 'https://security.opennet.ru' 'http://[$server_addr]/opennet/security'; + +sub_filter 'http://security.opennet.me' 'http://[$server_addr]/opennet/security'; +sub_filter 'https://security.opennet.me' 'http://[$server_addr]/opennet/security'; + +# palm +sub_filter 'http://palm.opennet.ru' 'http://[$server_addr]/opennet/palm'; +sub_filter 'https://palm.opennet.ru' 'http://[$server_addr]/opennet/palm'; + +sub_filter 'http://palm.opennet.me' 'http://[$server_addr]/opennet/palm'; +sub_filter 'https://palm.opennet.me' 'http://[$server_addr]/opennet/palm'; + +# grab +sub_filter 'http://grab.opennet.ru' 'http://[$server_addr]/opennet/grab'; +sub_filter 'https://grab.opennet.ru' 'http://[$server_addr]/opennet/grab'; + +sub_filter 'http://grab.opennet.me' 'http://[$server_addr]/opennet/grab'; +sub_filter 'https://grab.opennet.me' 'http://[$server_addr]/opennet/grab'; \ No newline at end of file diff --git a/nginx/opennet/include/locations/wiki.conf b/nginx/opennet/include/locations/wiki.conf new file mode 100644 index 0000000..0edc020 --- /dev/null +++ b/nginx/opennet/include/locations/wiki.conf @@ -0,0 +1,14 @@ +location /opennet/wiki { + + # Domain source + proxy_pass https://wiki.opennet.ru/; + + # Include common rules + include /etc/nginx/opennet/include/locations/include/common.conf; + + # Relative paths + sub_filter 'href="/' 'href="http://[$server_addr]/opennet/wiki/'; + sub_filter 'src="/' 'src="http://[$server_addr]/opennet/wiki/'; + sub_filter 'data-src="/' 'src="http://[$server_addr]/opennet/wiki/'; + sub_filter "url('/" "url('http://[$server_addr]/opennet/wiki/"; +} \ No newline at end of file diff --git a/nginx/opennet/include/locations/www-less.conf b/nginx/opennet/include/locations/www-less.conf new file mode 100644 index 0000000..5a6d629 --- /dev/null +++ b/nginx/opennet/include/locations/www-less.conf @@ -0,0 +1,14 @@ +location /opennet { + + # Domain source + proxy_pass https://opennet.ru/; + + # Include common rules + include /etc/nginx/opennet/include/locations/include/common.conf; + + # Relative paths + sub_filter 'href="/' 'href="http://[$server_addr]/opennet/'; + sub_filter 'src="/' 'src="http://[$server_addr]/opennet/'; + sub_filter 'data-src="/' 'src="http://[$server_addr]/opennet/'; + sub_filter "url('/" "url('http://[$server_addr]/opennet/"; +} \ No newline at end of file diff --git a/nginx/opennet/include/locations/www.conf b/nginx/opennet/include/locations/www.conf new file mode 100644 index 0000000..373f39d --- /dev/null +++ b/nginx/opennet/include/locations/www.conf @@ -0,0 +1,14 @@ +location /opennet/www { + + # Domain source + proxy_pass https://www.opennet.ru/; + + # Include common rules + include /etc/nginx/opennet/include/locations/include/common.conf; + + # Relative paths + sub_filter 'href="/' 'href="http://[$server_addr]/opennet/www/'; + sub_filter 'src="/' 'src="http://[$server_addr]/opennet/www/'; + sub_filter 'data-src="/' 'src="http://[$server_addr]/opennet/www/'; + sub_filter "url('/" "url('http://[$server_addr]/opennet/www/"; +} \ No newline at end of file diff --git a/nginx/opennet/locations.conf b/nginx/opennet/locations.conf new file mode 100644 index 0000000..ac89408 --- /dev/null +++ b/nginx/opennet/locations.conf @@ -0,0 +1,8 @@ +# www-less +include /etc/nginx/opennet/include/locations/www-less.conf; + +# www +include /etc/nginx/opennet/include/locations/www.conf; + +# wiki +include /etc/nginx/opennet/include/locations/wiki.conf; \ No newline at end of file diff --git a/nginx/opennet/server.conf b/nginx/opennet/server.conf new file mode 100644 index 0000000..48852ca --- /dev/null +++ b/nginx/opennet/server.conf @@ -0,0 +1,11 @@ +server { + + # HTTP/IPv6 connections only + # listen [::]:80 ipv6only=on _; + + # Yggdrasil connections only + # allow 0200::/7; + # deny all; + + include /etc/nginx/opennet/locations.conf; +} \ No newline at end of file diff --git a/nginx/opennet/www b/nginx/opennet/www deleted file mode 100644 index a54b081..0000000 --- a/nginx/opennet/www +++ /dev/null @@ -1,133 +0,0 @@ -# OpenNet Mirror -# -# https://www.opennet.ru -# https://www.opennet.me -# -# Configuration disable all JS by default, main menu requires exception @TODO -# https://github.com/YGGverse/issues/1 - -server { - - # HTTP/IPv6 connections only - # listen [::]:80 ipv6only=on; - - # Yggdrasil connections only - # allow 0200::/7; - # deny all; - - # 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; - - location /opennet/www { - - proxy_pass https://www.opennet.ru/; - - # . - # sub_filter 'http://opennet.ru' 'http://[$server_addr]/opennet'; - # sub_filter 'https://opennet.ru' 'http://[$server_addr]/opennet'; - - # sub_filter 'http://opennet.me' 'http://[$server_addr]/opennet'; - # sub_filter 'https://opennet.me' 'http://[$server_addr]/opennet'; - - # www - sub_filter 'http://www.opennet.ru' 'http://[$server_addr]/opennet/www'; - sub_filter 'https://www.opennet.ru' 'http://[$server_addr]/opennet/www'; - - sub_filter 'http://www.opennet.me' 'http://[$server_addr]/opennet/www'; - sub_filter 'https://www.opennet.me' 'http://[$server_addr]/opennet/www'; - - # m - # sub_filter 'http://m.opennet.ru' 'http://[$server_addr]/opennet/m'; - # sub_filter 'https://m.opennet.ru' 'http://[$server_addr]/opennet/m'; - - # sub_filter 'http://m.opennet.me' 'http://[$server_addr]/opennet/m'; - # sub_filter 'https://m.opennet.me' 'http://[$server_addr]/opennet/m'; - - # mobile - # sub_filter 'http://mobile.opennet.ru' 'http://[$server_addr]/opennet/mobile'; - # sub_filter 'https://mobile.opennet.ru' 'http://[$server_addr]/opennet/mobile'; - - # sub_filter 'http://mobile.opennet.me' 'http://[$server_addr]/opennet/mobile'; - # sub_filter 'https://mobile.opennet.me' 'http://[$server_addr]/opennet/mobile'; - - # wiki - # sub_filter 'http://wiki.opennet.ru' 'http://[$server_addr]/opennet/wiki'; - # sub_filter 'https://wiki.opennet.ru' 'http://[$server_addr]/opennet/wiki'; - - # sub_filter 'http://wiki.opennet.me' 'http://[$server_addr]/opennet/wiki'; - # sub_filter 'https://wiki.opennet.me' 'http://[$server_addr]/opennet/wiki'; - - # solaris - # sub_filter 'http://solaris.opennet.ru' 'http://[$server_addr]/opennet/solaris'; - # sub_filter 'https://solaris.opennet.ru' 'http://[$server_addr]/opennet/solaris'; - - # sub_filter 'http://solaris.opennet.me' 'http://[$server_addr]/opennet/solaris'; - # sub_filter 'https://solaris.opennet.me' 'http://[$server_addr]/opennet/solaris'; - - # bsd - # sub_filter 'http://bsd.opennet.ru' 'http://[$server_addr]/opennet/bsd'; - # sub_filter 'https://bsd.opennet.ru' 'http://[$server_addr]/opennet/bsd'; - - # sub_filter 'http://bsd.opennet.me' 'http://[$server_addr]/opennet/bsd'; - # sub_filter 'https://bsd.opennet.me' 'http://[$server_addr]/opennet/bsd'; - - # cisco - # sub_filter 'http://cisco.opennet.ru' 'http://[$server_addr]/opennet/cisco'; - # sub_filter 'https://cisco.opennet.ru' 'http://[$server_addr]/opennet/cisco'; - - # sub_filter 'http://cisco.opennet.me' 'http://[$server_addr]/opennet/cisco'; - # sub_filter 'https://cisco.opennet.me' 'http://[$server_addr]/opennet/cisco'; - - # linux - # sub_filter 'http://linux.opennet.ru' 'http://[$server_addr]/opennet/linux'; - # sub_filter 'https://linux.opennet.ru' 'http://[$server_addr]/opennet/linux'; - - # sub_filter 'http://linux.opennet.me' 'http://[$server_addr]/opennet/linux'; - # sub_filter 'https://linux.opennet.me' 'http://[$server_addr]/opennet/linux'; - - # web - # sub_filter 'http://web.opennet.ru' 'http://[$server_addr]/opennet/web'; - # sub_filter 'https://web.opennet.ru' 'http://[$server_addr]/opennet/web'; - - # sub_filter 'http://web.opennet.me' 'http://[$server_addr]/opennet/web'; - # sub_filter 'https://web.opennet.me' 'http://[$server_addr]/opennet/web'; - - # security - # sub_filter 'http://security.opennet.ru' 'http://[$server_addr]/opennet/security'; - # sub_filter 'https://security.opennet.ru' 'http://[$server_addr]/opennet/security'; - - # sub_filter 'http://security.opennet.me' 'http://[$server_addr]/opennet/security'; - # sub_filter 'https://security.opennet.me' 'http://[$server_addr]/opennet/security'; - - # palm - # sub_filter 'http://palm.opennet.ru' 'http://[$server_addr]/opennet/palm'; - # sub_filter 'https://palm.opennet.ru' 'http://[$server_addr]/opennet/palm'; - - # sub_filter 'http://palm.opennet.me' 'http://[$server_addr]/opennet/palm'; - # sub_filter 'https://palm.opennet.me' 'http://[$server_addr]/opennet/palm'; - - # grab - # sub_filter 'http://grab.opennet.ru' 'http://[$server_addr]/opennet/grab'; - # sub_filter 'https://grab.opennet.ru' 'http://[$server_addr]/opennet/grab'; - - # sub_filter 'http://grab.opennet.me' 'http://[$server_addr]/opennet/grab'; - # sub_filter 'https://grab.opennet.me' 'http://[$server_addr]/opennet/grab'; - - # Disable JS / trackers by default - sub_filter '' ' -->'; - - # Relative paths - sub_filter 'href="/' 'href="http://[$server_addr]/opennet/www/'; - sub_filter 'src="/' 'src="http://[$server_addr]/opennet/www/'; - sub_filter 'data-src="/' 'src="http://[$server_addr]/opennet/www/'; - sub_filter "url('/" "url('http://[$server_addr]/opennet/www/"; - - # Replace all matches - sub_filter_once off; - - # Enable multimedia replacement - sub_filter_types *; - } -} \ No newline at end of file diff --git a/nginx/opennet/www-less b/nginx/opennet/www-less deleted file mode 100644 index cad5939..0000000 --- a/nginx/opennet/www-less +++ /dev/null @@ -1,133 +0,0 @@ -# OpenNet Mirror -# -# https://opennet.ru -# https://opennet.me -# -# Configuration disable all JS by default, main menu requires exception @TODO -# https://github.com/YGGverse/issues/1 - -server { - - # HTTP/IPv6 connections only - # listen [::]:80 ipv6only=on; - - # Yggdrasil connections only - # allow 0200::/7; - # deny all; - - # 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; - - location /opennet { - - proxy_pass https://opennet.ru/; - - # . - sub_filter 'http://opennet.ru' 'http://[$server_addr]/opennet'; - sub_filter 'https://opennet.ru' 'http://[$server_addr]/opennet'; - - sub_filter 'http://opennet.me' 'http://[$server_addr]/opennet'; - sub_filter 'https://opennet.me' 'http://[$server_addr]/opennet'; - - # www - # sub_filter 'http://www.opennet.ru' 'http://[$server_addr]/opennet/www'; - # sub_filter 'https://www.opennet.ru' 'http://[$server_addr]/opennet/www'; - - # sub_filter 'http://www.opennet.me' 'http://[$server_addr]/opennet/www'; - # sub_filter 'https://www.opennet.me' 'http://[$server_addr]/opennet/www'; - - # m - # sub_filter 'http://m.opennet.ru' 'http://[$server_addr]/opennet/m'; - # sub_filter 'https://m.opennet.ru' 'http://[$server_addr]/opennet/m'; - - # sub_filter 'http://m.opennet.me' 'http://[$server_addr]/opennet/m'; - # sub_filter 'https://m.opennet.me' 'http://[$server_addr]/opennet/m'; - - # mobile - # sub_filter 'http://mobile.opennet.ru' 'http://[$server_addr]/opennet/mobile'; - # sub_filter 'https://mobile.opennet.ru' 'http://[$server_addr]/opennet/mobile'; - - # sub_filter 'http://mobile.opennet.me' 'http://[$server_addr]/opennet/mobile'; - # sub_filter 'https://mobile.opennet.me' 'http://[$server_addr]/opennet/mobile'; - - # wiki - # sub_filter 'http://wiki.opennet.ru' 'http://[$server_addr]/opennet/wiki'; - # sub_filter 'https://wiki.opennet.ru' 'http://[$server_addr]/opennet/wiki'; - - # sub_filter 'http://wiki.opennet.me' 'http://[$server_addr]/opennet/wiki'; - # sub_filter 'https://wiki.opennet.me' 'http://[$server_addr]/opennet/wiki'; - - # solaris - # sub_filter 'http://solaris.opennet.ru' 'http://[$server_addr]/opennet/solaris'; - # sub_filter 'https://solaris.opennet.ru' 'http://[$server_addr]/opennet/solaris'; - - # sub_filter 'http://solaris.opennet.me' 'http://[$server_addr]/opennet/solaris'; - # sub_filter 'https://solaris.opennet.me' 'http://[$server_addr]/opennet/solaris'; - - # bsd - # sub_filter 'http://bsd.opennet.ru' 'http://[$server_addr]/opennet/bsd'; - # sub_filter 'https://bsd.opennet.ru' 'http://[$server_addr]/opennet/bsd'; - - # sub_filter 'http://bsd.opennet.me' 'http://[$server_addr]/opennet/bsd'; - # sub_filter 'https://bsd.opennet.me' 'http://[$server_addr]/opennet/bsd'; - - # cisco - # sub_filter 'http://cisco.opennet.ru' 'http://[$server_addr]/opennet/cisco'; - # sub_filter 'https://cisco.opennet.ru' 'http://[$server_addr]/opennet/cisco'; - - # sub_filter 'http://cisco.opennet.me' 'http://[$server_addr]/opennet/cisco'; - # sub_filter 'https://cisco.opennet.me' 'http://[$server_addr]/opennet/cisco'; - - # linux - # sub_filter 'http://linux.opennet.ru' 'http://[$server_addr]/opennet/linux'; - # sub_filter 'https://linux.opennet.ru' 'http://[$server_addr]/opennet/linux'; - - # sub_filter 'http://linux.opennet.me' 'http://[$server_addr]/opennet/linux'; - # sub_filter 'https://linux.opennet.me' 'http://[$server_addr]/opennet/linux'; - - # web - # sub_filter 'http://web.opennet.ru' 'http://[$server_addr]/opennet/web'; - # sub_filter 'https://web.opennet.ru' 'http://[$server_addr]/opennet/web'; - - # sub_filter 'http://web.opennet.me' 'http://[$server_addr]/opennet/web'; - # sub_filter 'https://web.opennet.me' 'http://[$server_addr]/opennet/web'; - - # security - # sub_filter 'http://security.opennet.ru' 'http://[$server_addr]/opennet/security'; - # sub_filter 'https://security.opennet.ru' 'http://[$server_addr]/opennet/security'; - - # sub_filter 'http://security.opennet.me' 'http://[$server_addr]/opennet/security'; - # sub_filter 'https://security.opennet.me' 'http://[$server_addr]/opennet/security'; - - # palm - # sub_filter 'http://palm.opennet.ru' 'http://[$server_addr]/opennet/palm'; - # sub_filter 'https://palm.opennet.ru' 'http://[$server_addr]/opennet/palm'; - - # sub_filter 'http://palm.opennet.me' 'http://[$server_addr]/opennet/palm'; - # sub_filter 'https://palm.opennet.me' 'http://[$server_addr]/opennet/palm'; - - # grab - # sub_filter 'http://grab.opennet.ru' 'http://[$server_addr]/opennet/grab'; - # sub_filter 'https://grab.opennet.ru' 'http://[$server_addr]/opennet/grab'; - - # sub_filter 'http://grab.opennet.me' 'http://[$server_addr]/opennet/grab'; - # sub_filter 'https://grab.opennet.me' 'http://[$server_addr]/opennet/grab'; - - # Disable JS / trackers by default - sub_filter '' ' -->'; - - # Relative paths - sub_filter 'href="/' 'href="http://[$server_addr]/opennet/'; - sub_filter 'src="/' 'src="http://[$server_addr]/opennet/'; - sub_filter 'data-src="/' 'src="http://[$server_addr]/opennet/'; - sub_filter "url('/" "url('http://[$server_addr]/opennet/"; - - # Replace all matches - sub_filter_once off; - - # Enable multimedia replacement - sub_filter_types *; - } -} \ No newline at end of file