I tried to bring out DLNA when using the audio media at home outdoors. The environment is limited, but I managed to do it, so a memorandum.
Terminal | place | OS example | role | host name | Global IP | VPN IP | Private IP |
---|---|---|---|---|---|---|---|
Server (1) | home | Cent OS 7 (Raspberry Pi 3) |
DLNA Server | 192.168.5.2 | 192.168.1.2 | ||
Server (2) | rental | Cent OS 7 (rental) |
HTTP Gateway | dlna.mydomain.org | available | 192.168.5.3 | |
Client | Outdoor | android / iPhone | Player |
Set the association between the global IP of Server (2) and the host name. (Domain registrar, DDNS service site, etc.)
Install ReadyMedia on your local server and build a DLNA server. (The construction method is omitted because it is 2 ^ 10 decoction)
Because it is a reverse proxy, the purpose is to enable mutual communication between servers. Not required if both servers are on the same network. Also, VPN construction is possible other than Tinc VPN, so it is omitted. (I mean, it gets longer when I write it ...)
The main part of this article. Set Reverse Proxy on Virtual Host. DLNA communicates with the server in XML, Because the full path to the content includes the IP address is returned You cannot reach the media through the Reverse Proxy. Therefore, replace the IP described in XML with the host address. Since the communication between the servers is via VPN, the replacement source IP is the VPN IP.
item | value |
---|---|
hostname | dlna.mydomain.org |
Forwarding destination | 192.168.5.2:8200 |
apache:/etc/httpd/conf.d/httpd-vhosts.conf
<VirtualHost *:80>
ServerName dlna.mydomain.org
AddOutputFilterByType SUBSTITUTE text/xml
Substitute "s|192.168.5.2:8200|dlna.mydomain.org|i"
ProxyRequests Off
ProxyPass / http://192.168.5.2:8200/
ProxyPassReverse / http://192.168.5.2:8200/
</VirtualHost>
terminal
systemctl restart httpd.service
Listen using the smartphone version of foobar2000.
item | value |
---|---|
Client | foober2000 (Google Play,AppStore) |
URL | http://dlna.mydomain.org/rootDesc.xml |
-Mod_substitute --Apache HTTP Server Version 2.4 https://httpd.apache.org/docs/2.4/mod/mod_substitute.html -VirtualHost for reverse proxy to access with completely different IP / host name --Qiita https://qiita.com/tkykmw/items/d7f07f26b89f923d57d5 -Text rewriting by Apache mod_substitute + mod_filter --doodle-on-web https://www.doodle-office.work/entry/mod_substitute_mod_filter ยท Mod rewrite --Apache mod_substitute on HTTP request to reverse proxyed host --Tutorial for beginners https://tutorialmore.com/questions-757269.htm