Skip to content

Commit

Permalink
Instructions and some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgorbatchev committed Oct 4, 2014
1 parent 68b3962 commit a278959
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 75 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
media_proxy/ssl
media_proxy/htpasswd
*.swp


conf.d
fastcgi_params
koi-utf
koi-win
mime.types
scgi_params
uwsgi_params
win-utf


27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
nginx-plex-deluge-proxy
=======================

This is an NGINX configuration to allow plex and deluge reverse proxy.

It gives you the following paths:

* `https://X.X.X.X/plex`
* `https://X.X.X.X/deluge`

## Installation

### Step 1

These files need to be copied/cloned into the NGINX config folder, for example `/etc/nginx` on Ubuntu.

### Step 2

You then need to generate self signed SSL certificate:

```bash
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout media_proxy/ssl/nginx.key -out media_proxy/ssl/nginx.crt
```

### Step 3

Create `media_proxy/htpasswd` file using [this handy site](http://www.htaccesstools.com/htpasswd-generator/) or native means, whatever you feel comfortable with. This username/password will be prompted for when you try to access the proxy.


23 changes: 4 additions & 19 deletions media_proxy/proxy-control.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
proxy_connect_timeout 59s;
proxy_send_timeout 600;
#proxy_read_timeout 600;
proxy_read_timeout 36000s; ## Timeout after 10 hours
proxy_buffer_size 64k;
proxy_buffers 16 32k;
Expand All @@ -19,29 +18,15 @@ proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-For $remote_addr;

proxy_set_header X-Forwarded-Port '443';
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Authorization '';

proxy_buffering off;

proxy_redirect off;
#proxy_redirect default;
#proxy_redirect http://example.net/ /;
#proxy_redirect https://example.net/ /;
#proxy_redirect http://$host/ /;
#proxy_redirect http:// https://;

#more_clear_headers 'referer';
#RequestHeader unset referer
#proxy_hide_header referer;
#proxy_ignore_headers referer;

proxy_buffering off;
proxy_redirect off;

## Required for Websockets
proxy_http_version 1.1;
## Required for Plex WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
40 changes: 0 additions & 40 deletions media_proxy/services.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,3 @@ location /deluge {
include media_proxy/auth-basic.conf;
}


#
# Untested configurations for other services
#

# location /monit {
# rewrite ^/monit$ https://example.net/monit/ permanent;
# rewrite ^/monit/(.*) /$1 break;
#
# proxy_pass http://localhost:2812/;
# include media_proxy/proxy-control.conf;
# include media_proxy/auth-basic.conf;
# }
#
# location /sickbeard {
# proxy_pass http://localhost:8081/sickbeard;
# include media_proxy/proxy-control.conf;
# include media_proxy/auth-basic.conf;
# }
#
# location /sabnzbd {
# proxy_pass http://localhost:8080/sabnzbd;
# include media_proxy/proxy-control.conf;
# include media_proxy/auth-basic.conf;
# }
#
# location /couchpotato {
# proxy_pass http://localhost:5050/couchpotato;
# include media_proxy/proxy-control.conf;
# include media_proxy/auth-basic.conf;
# proxy_set_header Host localhost:5050;
# proxy_redirect default;
# }
#
# location /headphones {
# proxy_pass http://localhost:8181/headphones;
# include media_proxy/proxy-control.conf;
# include media_proxy/auth-basic.conf;
# }

28 changes: 12 additions & 16 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;
sendfile on;
#tcp_nopush on;

keepalive_timeout 65;
keepalive_timeout 65;

#gzip on;
#gzip on;

#include /etc/nginx/conf.d/*.conf;
include /etc/nginx/media_proxy/site-available.conf;
include /etc/nginx/media_proxy/site-available.conf;
}

0 comments on commit a278959

Please sign in to comment.