Jump to content


Photo

[Solved] Emby apach vhost

apache vhost proxy

Best Answer Okeur75 , 02 May 2019 - 04:10 PM

Hello guys, I found the solution and wanted to share if someone needs it.

 

The issue was actually I have only one domain name and no subdomain. So there is no real vhost running on my server, just multiple website in different folders or as Emby, managed by their own web server. The issue was 2 vhost files both catching the same domain name, hence only the first one was catched and the second one ignore. That's why Emby was working when enabled first, and Transmission no working, or the opposite when Transmission was enabled first.

 

To sum up, here is the config file which is working in my case : Transmission torrent client running on 9091 + Emby running on 8920

<VirtualHost *:80>
        ServerName yoann.host
        ServerAlias www.yoann.host
        Redirect permanent /transmission https://yoann.host/transmission
        Redirect permanent /emby https://yoann.host/emby
</Virtualhost>

<VirtualHost *:443>
        ServerName yoann.host
        ServerAlias www.yoann.host
        Redirect permanent /transmission https://yoann.host/transmission
        Redirect permanent /emby https://yoann.host/emby

        ErrorLog ${APACHE_LOG_DIR}/transmission_emby_error_log
        LogFormat "%t \"%r\" %>s" common
        CustomLog ${APACHE_LOG_DIR}/transmission_emby_access_log common

        RewriteEngine on
        RewriteRule /transmission[/]?$ /transmission/web/ [R]
        RewriteRule ^/emby$ /emby/ [R]

        ProxyRequests On
        ProxyPreserveHost Off

        <Proxy *>
        Order allow,deny
        Allow from all
        </Proxy>

        <location /transmission>
                ProxyPass http://127.0.0.1:9091/transmission
                ProxyPassReverse http://127.0.0.1:9091/transmission
        </location>

        <location /emby>
                ProxyPass  http://127.0.0.1:8096/emby
                ProxyPassReverse  http://127.0.0.1:8096/emby
        </location>

        <location /embywebsocket>
                ProxyPass  http://127.0.0.1:8096/embywebsocket
                ProxyPassReverse  http://127.0.0.1:8096/embywebsocket
        </location>
</Virtualhost>

Glad if it helps someone and thanks to both of you guys for taking a look.

Go to the full post


  • Please log in to reply
6 replies to this topic

#1 Okeur75 OFFLINE  

Okeur75

    Advanced Member

  • Members
  • 59 posts
  • Local time: 11:51 PM

Posted 30 April 2019 - 02:39 PM

Hello guys,

 

Yes another apache reverse proxy tuto but I'm a bit stuck !

 

I found a vhost config that works in my case :

<VirtualHost *:80>
    ServerName       my.website
    Redirect         permanent /emby https://my.website/emby
</VirtualHost>

<VirtualHost *:443>
	ServerName my.website

	ErrorLog ${APACHE_LOG_DIR}/emby-error_log
	LogFormat "%t \"%r\" %>s" common
	CustomLog ${APACHE_LOG_DIR}/emby-access_log common

	RewriteEngine on
	RewriteRule ^/emby$ /emby/ [R]

	<proxy *>
	AddDefaultCharset off
	Order Allow,Deny
	Allow from all
	</proxy>

	ProxyRequests     Off
	ProxyPreserveHost On

	<Location /emby>
			ProxyPass        http://localhost:8096
			ProxyPassReverse http://localhost:8096
	</Location>

	<Location /emby/emby>
			ProxyPass        ws://localhost:8096/emby
			ProxyPassReverse ws://localhost:8096/emby
	</Location>
</VirtualHost>

If I only enable this vhost it's working.

 

But ! I also have transmission running with the following configuration:

<VirtualHost *:443>
        ServerName my.website
        ServerAlias www.my.website
        Redirect permanent /transmission https://my.website/transmission

        RewriteEngine on
        RewriteRule /transmission[/]?$ /transmission/web/ [R=permanent]

        ProxyRequests On
        ProxyPreserveHost Off
        <Proxy *>
        Order allow,deny
        Allow from all
        </Proxy>

        ProxyPass /transmission http://127.0.0.1:9091/transmission
        ProxyPassReverse /transmission http://127.0.0.1:9091/transmission
</Virtualhost>

<VirtualHost *:80>
        ServerName my.website
        ServerAlias www.my.website
        Redirect permanent /transmission https://my.website/transmission
</Virtualhost>

If I enable emby first (by renaming the file 01-emby and 03-transmission) : emby is working but transmission is not.

If I enable transmission first (01-transmission and 03-emby) : transmission is working and emby is not with the following error message : You don't have permission to access /emby on this server.

So I guess there is some issue with the rewrite rule.

 

In emby dashboard I selected the "Secure connection mode" parameter to "Handled by reverse proxy".

 

For info https://my.website:8920/emby is working.

 

I'm not really familiar with Apache so I may have missed something obvious.

 

Thanks for your help guys !


Edited by Okeur75, 02 May 2019 - 04:11 PM.


#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 128908 posts
  • Local time: 06:51 PM

Posted 30 April 2019 - 02:42 PM

@pir8radio are you familiar with transmission?



#3 pir8radio OFFLINE  

pir8radio

    NGINX

  • Members
  • 2731 posts
  • Local time: 05:51 PM
  • LocationChicago

Posted 30 April 2019 - 06:12 PM

@pir8radio are you familiar with transmission?

 

 

Yea, but I think his issue is config related..   I assume when you say you use transmission you mean the web interface to the torrent client?   

 

Post your whole apache config with both transmission and emby sections in that you want...  and lets take a look at it. 

 

switch to nginx and we can get you up in no time!  :-)


Edited by pir8radio, 30 April 2019 - 06:12 PM.


#4 Okeur75 OFFLINE  

Okeur75

    Advanced Member

  • Members
  • 59 posts
  • Local time: 11:51 PM

Posted 01 May 2019 - 01:40 AM

Thanks @Luke

Thanks @pir8radio

 

Yes it's totally configuration related. Emby is working fine otherwise. I know it's a bit bordeline for Emby's support but this is the only forum with strong knowledge about emby and its related vhost configuration.

 

Yes I meant the web interface of Transmission

 

What else do you need apart from the vhost configuration ?

I have 2 other vhost that are not impacted by any change on emby or transmission vhost configuration, and the rest of the apache configuration is just ssl and includes statement in the main apache.conf file. I can copy paste everything if you need it but I'd surprised it helps.

 

I'm not really keen to switch to Nginx, not that I have specific needs for Apache, but I would like first to understand how to do something and not switch to a whole new solution just because I don't understand. I'm pretty sure few lines need to be modified to make this work :)

 

Edit : also the goal design if it helps

http://my.website/nextcloud -> https://my.website/nextcloud (working)

http://my.website/zabbix -> https://my.website/zabbix (working)

http://my.website/transmission -> https://my.website/transmission (which is also a redirect to http://127.0.0.1:9091/transmission) Working if enabled before Emby

http://my.website/emby -> https://my.website/transmission (which is also a redirect to http://127.0.0.1:8096) Working if enabled before Transmission

http://my.website/ -> you don't have the permission to access / on this server (as expected)

https://my.website/ -> you don't have the permission to access / on this server (as expected)


Edited by Okeur75, 01 May 2019 - 01:45 AM.


#5 Okeur75 OFFLINE  

Okeur75

    Advanced Member

  • Members
  • 59 posts
  • Local time: 11:51 PM

Posted 02 May 2019 - 04:10 PM   Best Answer

Hello guys, I found the solution and wanted to share if someone needs it.

 

The issue was actually I have only one domain name and no subdomain. So there is no real vhost running on my server, just multiple website in different folders or as Emby, managed by their own web server. The issue was 2 vhost files both catching the same domain name, hence only the first one was catched and the second one ignore. That's why Emby was working when enabled first, and Transmission no working, or the opposite when Transmission was enabled first.

 

To sum up, here is the config file which is working in my case : Transmission torrent client running on 9091 + Emby running on 8920

<VirtualHost *:80>
        ServerName yoann.host
        ServerAlias www.yoann.host
        Redirect permanent /transmission https://yoann.host/transmission
        Redirect permanent /emby https://yoann.host/emby
</Virtualhost>

<VirtualHost *:443>
        ServerName yoann.host
        ServerAlias www.yoann.host
        Redirect permanent /transmission https://yoann.host/transmission
        Redirect permanent /emby https://yoann.host/emby

        ErrorLog ${APACHE_LOG_DIR}/transmission_emby_error_log
        LogFormat "%t \"%r\" %>s" common
        CustomLog ${APACHE_LOG_DIR}/transmission_emby_access_log common

        RewriteEngine on
        RewriteRule /transmission[/]?$ /transmission/web/ [R]
        RewriteRule ^/emby$ /emby/ [R]

        ProxyRequests On
        ProxyPreserveHost Off

        <Proxy *>
        Order allow,deny
        Allow from all
        </Proxy>

        <location /transmission>
                ProxyPass http://127.0.0.1:9091/transmission
                ProxyPassReverse http://127.0.0.1:9091/transmission
        </location>

        <location /emby>
                ProxyPass  http://127.0.0.1:8096/emby
                ProxyPassReverse  http://127.0.0.1:8096/emby
        </location>

        <location /embywebsocket>
                ProxyPass  http://127.0.0.1:8096/embywebsocket
                ProxyPassReverse  http://127.0.0.1:8096/embywebsocket
        </location>
</Virtualhost>

Glad if it helps someone and thanks to both of you guys for taking a look.


  • Luke likes this

#6 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 128908 posts
  • Local time: 06:51 PM

Posted 02 May 2019 - 05:25 PM

That's great info, thanks for following up !



#7 pir8radio OFFLINE  

pir8radio

    NGINX

  • Members
  • 2731 posts
  • Local time: 05:51 PM
  • LocationChicago

Posted 02 May 2019 - 11:37 PM

Hello guys, I found the solution and wanted to share if someone needs it.

 

The issue was actually I have only one domain name and no subdomain. So there is no real vhost running on my server, just multiple website in different folders or as Emby, managed by their own web server. The issue was 2 vhost files both catching the same domain name, hence only the first one was catched and the second one ignore. That's why Emby was working when enabled first, and Transmission no working, or the opposite when Transmission was enabled first.

 

To sum up, here is the config file which is working in my case : Transmission torrent client running on 9091 + Emby running on 8920


Glad if it helps someone and thanks to both of you guys for taking a look.

 

 

I think you might find some things not working correctly with a sub directory, vs using a sub domain     emby.domain.com, transmission.domain.com     But let us know how it goes..  :-)







Also tagged with one or more of these keywords: apache, vhost, proxy

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users