Skip to content

Commit e30f0b2

Browse files
authored
Merge pull request #1 from Xarin/master
Basic Apache configuration
2 parents 912e335 + 59cc247 commit e30f0b2

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

README md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Apache configuration
2+
3+
This repository contains Apache configuration examples for the UnicornTranscoder project. It still has a few bugs but seems to work well enough to stream through a browser, Android phone/tv or iPhone. Roku seems unhapy though.
4+
5+
## UnicornTranscoder Project
6+
7+
- [UnicornTranscoder](https://github.com/UnicornTranscoder/UnicornTranscoder)
8+
- [UnicornLoadBalancer](https://github.com/UnicornTranscoder/UnicornLoadBalancer)
9+
- [UnicornFFMPEG](https://github.com/UnicornTranscoder/UnicornFFMPEG)
10+
11+
## Credit
12+
https://gist.github.com/HazCod/3ef10a15f52c171a7839
13+
https://gist.github.com/hharsunen/afc9f66c94b7bb9c62ed37e4e14507a6

UnicornLoadBalancer.conf

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<VirtualHost *:80>
2+
ServerName myplex.com
3+
Redirect permanent / https://myplex.com
4+
</VirtualHost>
5+
6+
<VirtualHost *:443>
7+
ServerName myplex.com
8+
9+
# Logs
10+
ErrorLog /var/log/httpd/transcoder.myplex.com-error_log
11+
CustomLog /var/log/httpd/transcoder.myplex.com-access_log common
12+
13+
# SSL
14+
SSLStrictSNIVHostCheck On
15+
SSLEngine On
16+
SSLCertificateFile "/etc/letsencrypt/live/myplex.com/fullchain.pem"
17+
SSLCertificateKeyFile "/etc/letsencrypt/live/myplex.com/privkey.pem"
18+
SSLProtocol +TLSv1.2
19+
ProtocolsHonorOrder On
20+
Protocols h2 http/1.1
21+
22+
Options -Includes -ExecCGI
23+
RewriteEngine On
24+
LimitRequestBody 512000
25+
26+
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
27+
Header always set X-Frame-Options DENY
28+
FileETag None
29+
TraceEnable off
30+
Header edit Set-Cookie ^(.*)$ ;HttpOnly;Secure
31+
Header set X-XSS-Protection "1; mode=block"
32+
Timeout 60
33+
34+
<Location /:/websockets/notifications>
35+
ProxyPass wss://<LoadBalancerIP>:<LoadBalancerPort>/:/websockets/notifications
36+
ProxyPassReverse wss://<LoadBalancerIP>:<LoadBalancerPort>/:/websockets/notifications
37+
</Location>
38+
39+
# Proxy configuration
40+
<Proxy "*">
41+
Require all granted
42+
</Proxy>
43+
44+
ProxyRequests Off
45+
ProxyPreserveHost On
46+
SSLProxyEngine on
47+
48+
SSLProxyProtocol -ALL +TLSv1.2
49+
50+
ProxyPass / http://<LoadBalancerIP>:<LoadBalancerPort>/
51+
ProxyPassReverse / http://<LoadBalancerIP>:<LoadBalancerPort>/
52+
53+
RewriteCond %{REQUEST_URI} !^/web
54+
# plex web uses query strings, not headers
55+
RewriteCond %{QUERY_STRING} !(.*(?:^|&))X-Plex-Device=(.*)((?:&|$).*)
56+
RewriteCond %{HTTP:X-Plex-Device} ^$
57+
RewriteCond %{REQUEST_METHOD} !^(OPTIONS)$
58+
RewriteRule ^/$ /web/$1? [R,L]
59+
</VirtualHost>

UnicornTranscoder.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<VirtualHost *:80>
2+
ServerName transcoder.myplex.com
3+
Redirect permanent / https://transcoder.myplex.com
4+
</VirtualHost>
5+
6+
<VirtualHost *:443>
7+
ServerName transcoder.myplex.com
8+
9+
# Logs
10+
ErrorLog /var/log/httpd/transcoder.myplex.com-error_log
11+
CustomLog /var/log/httpd/transcoder.myplex.com-access_log common
12+
13+
# SSL managed by Certbot
14+
SSLEngine On
15+
SSLProxyEngine on
16+
SSLCertificateFile "/etc/letsencrypt/live/myplex-t1.com/fullchain.pem"
17+
SSLCertificateKeyFile "/etc/letsencrypt/live/myplex-t1.com/privkey.pem"
18+
19+
# Proxy
20+
ProxyRequests Off
21+
ProxyPreserveHost On
22+
ProxyPass / http://<UnicornTranscoderIP>:<port>/
23+
ProxyPassReverse / http://<UnicornTranscoderIP>:<port>/
24+
</VirtualHost>

0 commit comments

Comments
 (0)