Browse Source

first commit

master
root 5 months ago
commit
ea3d2405ba
7 changed files with 186 additions and 0 deletions
  1. 7
    0
      .gitignore
  2. 16
    0
      README.md
  3. 19
    0
      config/apache/Dockerfile
  4. 27
    0
      config/apache/apache.conf
  5. 40
    0
      data/public/.htaccess
  6. 52
    0
      data/public/index.html
  7. 25
    0
      docker-compose.yml

+ 7
- 0
.gitignore View File

@@ -0,0 +1,7 @@
1
+
2
+/data/public/targets/*
3
+/.env
4
+*~
5
+\#*\#
6
+.\#*
7
+/logs

+ 16
- 0
README.md View File

@@ -0,0 +1,16 @@
1
+
2
+# Luna's No-Referrer Redirect Page
3
+
4
+## A very simple and lightweight redirect gateway
5
+
6
+---
7
+
8
+## Installation:
9
+
10
+```
11
+cd /var/apps # or wherever you want to install it
12
+git clone https://code.can-i.help/luna/luna-noreferrer-redirect && cd luna-noreferrer-redirect
13
+cp .env.template .env
14
+gedit .env
15
+docker-compose up -d
16
+```

+ 19
- 0
config/apache/Dockerfile View File

@@ -0,0 +1,19 @@
1
+ARG APACHE_VERSION
2
+FROM httpd:${APACHE_VERSION}
3
+
4
+RUN apk update; \
5
+apk upgrade; \
6
+apk add apache2-utils;
7
+
8
+RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf
9
+
10
+RUN { \
11
+  echo 'IncludeOptional conf.d/*.conf'; \
12
+  } >> /usr/local/apache2/conf/httpd.conf \
13
+    && mkdir /usr/local/apache2/conf.d
14
+
15
+COPY apache.conf /usr/local/apache2/conf/apache.conf
16
+
17
+RUN echo "Include /usr/local/apache2/conf/apache.conf" \
18
+>> /usr/local/apache2/conf/httpd.conf
19
+

+ 27
- 0
config/apache/apache.conf View File

@@ -0,0 +1,27 @@
1
+
2
+LoadModule deflate_module /usr/local/apache2/modules/mod_deflate.so
3
+LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so
4
+LoadModule proxy_fcgi_module /usr/local/apache2/modules/mod_proxy_fcgi.so
5
+
6
+#Listen 0.0.0.0:80
7
+
8
+<VirtualHost *:80>
9
+
10
+	     ServerName apache
11
+	     DocumentRoot /var/www/html/
12
+
13
+	     <Directory /var/www/html>
14
+	             Require all granted
15
+	     	     Order deny,allow
16
+	     	     Allow from all
17
+		     AllowOverride All
18
+		     DirectoryIndex index.html
19
+	     </Directory>
20
+
21
+	     # Send apache logs to stdout and stderr
22
+	     CustomLog /apache-logs/log common
23
+	     # /proc/self/fd/1 common
24
+	     ErrorLog /apache-logs/log_error
25
+	     # /proc/self/fd/2
26
+
27
+</VirtualHost>

+ 40
- 0
data/public/.htaccess View File

@@ -0,0 +1,40 @@
1
+
2
+<IfModule mod_rewrite.c>
3
+RewriteEngine On
4
+RewriteBase /
5
+RewriteRule ^index\.php$ - [L]
6
+RewriteCond %{REQUEST_FILENAME} !-f
7
+RewriteCond %{REQUEST_FILENAME} !-d
8
+RewriteRule . /index.php [L]
9
+</IfModule>
10
+
11
+<IfModule mod_deflate.c>
12
+# Compress HTML, CSS, JavaScript, Text, XML and fonts
13
+AddOutputFilterByType DEFLATE application/javascript
14
+AddOutputFilterByType DEFLATE application/rss+xml
15
+AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
16
+AddOutputFilterByType DEFLATE application/x-font
17
+AddOutputFilterByType DEFLATE application/x-font-opentype
18
+AddOutputFilterByType DEFLATE application/x-font-otf
19
+AddOutputFilterByType DEFLATE application/x-font-truetype
20
+AddOutputFilterByType DEFLATE application/x-font-ttf
21
+AddOutputFilterByType DEFLATE application/x-javascript
22
+AddOutputFilterByType DEFLATE application/xhtml+xml
23
+AddOutputFilterByType DEFLATE application/xml
24
+AddOutputFilterByType DEFLATE font/opentype
25
+AddOutputFilterByType DEFLATE font/otf
26
+AddOutputFilterByType DEFLATE font/ttf
27
+AddOutputFilterByType DEFLATE image/svg+xml
28
+AddOutputFilterByType DEFLATE image/x-icon
29
+AddOutputFilterByType DEFLATE text/css
30
+AddOutputFilterByType DEFLATE text/html
31
+AddOutputFilterByType DEFLATE text/javascript
32
+AddOutputFilterByType DEFLATE text/plain
33
+AddOutputFilterByType DEFLATE text/xml
34
+
35
+# Remove browser bugs (only needed for really old browsers)
36
+BrowserMatch ^Mozilla/4 gzip-only-text/html
37
+BrowserMatch ^Mozilla/4\.0[678] no-gzip
38
+BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
39
+Header append Vary User-Agent
40
+</IfModule>

+ 52
- 0
data/public/index.html View File

@@ -0,0 +1,52 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+
5
+    <meta charset="UTF-8">
6
+    <meta name="viewport" content="width=device-width">
7
+
8
+    <title>Redirecting..</title>
9
+    
10
+    <meta name="robots" content="noindex, nofollow">
11
+    <meta name="referrer" content="never">
12
+
13
+    <script>
14
+      
15
+	var i = 2;
16
+	var interval = setInterval(function(){
17
+	i--;
18
+	if (i <= 0){
19
+		 document.getElementById('in').style.display = 'none';
20
+	
21
+		 var iframe = document.createElement('iframe');
22
+		 var url = decodeURIComponent(window.top.location.toString().replace(/^.*\?to=(.*)$/, '$1'));
23
+		 iframe.style.display = 'none';
24
+		 iframe.src = 'javascript:window.top.location.replace("'+url.replace(/"/g, '&quot;')+'")';
25
+ 		 iframe.referrerpolicy = "no-referrer";
26
+		 document.getElementsByTagName('body')[0].appendChild(iframe);
27
+		 clearInterval(interval);
28
+
29
+	} else 
30
+	         document.getElementById('in').innerHTML = 'in <span>'+i+'s</span>';
31
+	
32
+	}, 1000);
33
+	
34
+    </script>
35
+    <style>
36
+      html, body { margin: 0; padding: 0; box-sizing: border-box; line-height: normal; text-align: center; font-family: monospace; font-size: 30px; }
37
+      header {
38
+      margin: 50px 0 0;
39
+      padding: 10px 20px;
40
+      }
41
+      #in {
42
+      font-size: 12px; margin-top: 8px;
43
+      }
44
+      </style>
45
+  </head>
46
+  <body>
47
+    <header>
48
+      Redirecting..
49
+      <div id="in">in <span>2s</span></div>
50
+      </header>
51
+  </body>
52
+</html>

+ 25
- 0
docker-compose.yml View File

@@ -0,0 +1,25 @@
1
+version: "3.2"
2
+
3
+services:
4
+
5
+  redirect_apache:
6
+    build:
7
+      context: ./config/apache
8
+      dockerfile: Dockerfile
9
+      args:
10
+        APACHE_VERSION: ${APACHE_VERSION}
11
+    volumes:
12
+    - ./data/public:/var/www/html:rw
13
+    - ./logs/apache:/apache-logs:rw
14
+    networks:
15
+    - proxy
16
+    environment:
17
+    - VIRTUAL_HOST
18
+    - VIRTUAL_PORT=80
19
+    - LETSENCRYPT_HOST
20
+    - LETSENCRYPT_EMAIL
21
+
22
+networks:
23
+  proxy:
24
+    external:
25
+      name: nginx-proxy

Loading…
Cancel
Save