From d21b314aca6ef5e6da0bd6bae19b97ca3106d037 Mon Sep 17 00:00:00 2001 From: Jesper Wrang Date: Sun, 12 Nov 2017 01:24:24 +0100 Subject: [PATCH] Updated readme --- README.md | 12 ++++++------ {config => server-config}/basic | 19 ++++++++++++++----- {config => server-config}/letsencrypt.conf | 0 {config => server-config}/ssl | 14 +++++++++++--- 4 files changed, 31 insertions(+), 14 deletions(-) rename {config => server-config}/basic (51%) rename {config => server-config}/letsencrypt.conf (100%) rename {config => server-config}/ssl (79%) diff --git a/README.md b/README.md index 190251e..01704cb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Removeddit -[Removeddit](https://removeddit.com) is a site for viewing removed and deleted comments from [Reddit](https://www.reddit.com). +[Removeddit](https://removeddit.com) is a site for viewing removed and deleted comments/posts from [Reddit](https://www.reddit.com). Usage: go to any reddit thread and change the `reddit` in the URL to `removeddit`. The site will only display the removed comments and thier parents, not the full thread. @@ -10,7 +10,7 @@ Using [Ubuntu 16.04](http://releases.ubuntu.com/16.04/) and [nginx](https://www. ``` sudo git clone https://github.com/JubbeArt/removeddit.git /var/www/removeddit sudo apt install -y nginx -sudo cp /var/www/removeddit/config/basic /etc/nginx/sites-available/default +sudo cp /var/www/removeddit/server-config/basic /etc/nginx/sites-available/default ``` Create a reddit app [here](https://www.reddit.com/prefs/apps/), select **installed app**. For "redirect url" it doesn't really matter in this case, you can pick `http://localhost`. @@ -44,13 +44,13 @@ In the same file you also want to change `gzip on` to `gzip off` (read more [her ## Nginx server config Copy the ssl config and create a soft link. Create folder for logs and also remove the default config ``` -sudo cp /var/www/removeddit/config/ssl /etc/nginx/sites-available/removeddit.com +sudo cp /var/www/removeddit/server-config/ssl /etc/nginx/sites-available/removeddit.com sudo ln -s /etc/nginx/sites-available/removeddit.com /etc/nginx/sites-enabled/removeddit.com sudo mkdir /var/log/nginx/removeddit sudo rm /etc/nginx/sites-enabled/default ``` -Change both the "server_name" in the config to your domain name. +Change the "server_name" for both server blocks in the config to your own domain name. ## SSL with Let's encrypt Read the full guide [here](https://certbot.eff.org/#ubuntutyakkety-nginx). Start of by installing the Let's Encrypt client [certbot](https://certbot.eff.org/) @@ -64,13 +64,13 @@ sudo apt install -y python-certbot-nginx Copy the Let's Encrypt config file for our site ``` sudo mkdir /etc/letsencrypt/configs -cp /var/www/removeddit/config/letsencrypt.conf /etc/letsencrypt/configs/removeddit.com.conf +cp /var/www/removeddit/server-config/letsencrypt.conf /etc/letsencrypt/configs/removeddit.com.conf ``` In this config file change the domains and the email address for your own. The emails tells you when the certificates are close to expiring. This is when the webmasters start praying to God, for only He can deside the fate of the certbot. -Forgive me, Father, for I have sinned. Just don't fuck up certs you asshole. +Forgive me Father, for I have committed. ``` sudo certbot --config /etc/letsencrypt/configs/removeddit.com.conf certonly ``` diff --git a/config/basic b/server-config/basic similarity index 51% rename from config/basic rename to server-config/basic index ac2ac86..df5bd80 100644 --- a/config/basic +++ b/server-config/basic @@ -3,18 +3,27 @@ server { listen [::]:80 default_server; root /var/www/removeddit; - index index.html; + index about.html; server_name _; - location / { - try_files /index.html /index.html =404; + location ~* /r/[a-zA-Z0-9]+/[a-zA-Z0-9] { + try_files /thread.html /thread.html =404; } location /r/ { - try_files /thread.html /thread.html =404; + try_files /subreddit.html /subreddit.html =404; } location /static/ { try_files $uri $uri/ =404; } -} \ No newline at end of file + + location /about/ { + try_files /about.html /about.html =404; + } + + location / { + try_files /subreddit.html /subreddit.html =404; + } +} + diff --git a/config/letsencrypt.conf b/server-config/letsencrypt.conf similarity index 100% rename from config/letsencrypt.conf rename to server-config/letsencrypt.conf diff --git a/config/ssl b/server-config/ssl similarity index 79% rename from config/ssl rename to server-config/ssl index aef4e04..9111c27 100644 --- a/config/ssl +++ b/server-config/ssl @@ -13,16 +13,24 @@ server { #ssl_certificate /etc/letsencrypt/live/removeddit.com/fullchain.pem; #ssl_certificate_key /etc/letsencrypt/live/removeddit.com/privkey.pem; - location / { - try_files /index.html /index.html =404; + location ~* /r/[a-zA-Z0-9]+/[a-zA-Z0-9] { + try_files /thread.html /thread.html =404; } location /r/ { - try_files /thread.html /thread.html =404; + try_files /subreddit.html /subreddit.html =404; } location /static/ { try_files $uri $uri/ =404; + } + + location /about/ { + try_files /about.html /about.html =404; + } + + location / { + try_files /subreddit.html /subreddit.html =404; } }