Results 1 to 6 of 6

Thread: VirtualHosts and Synology NAS

  1. #1
    Join Date
    Oct 2011
    Beans
    9

    Post VirtualHosts and Synology NAS

    Hi, I'm trying to setup a reverse proxy to point my webaddress to different home servers or ports. So what I'm basically trying to do is
    name.dyndns-ip.com --> website on localhost
    adm.name.dyndns-ip.com --> port ... on localhost
    subsonic.name.dyndns-ip.com --> port ... on other internal ip
    camera.name.dyndns-ip.com --> other internal ip
    I edited the httpd-vhost.conf-user like this:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName name.dyndns-ip.com
    ServerAlias name.dyndns-ip.com
    ProxyRequests Off
    ProxyVia Off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass / http://internal:4040/
    ProxyPassReverse / http://internal:4040/
    </VirtualHost>
    <VirtualHost *:80>
    ServerName adm.name.dyndns-ip.com
    ServerAlias adm.name.dyndns-ip.com
    ProxyRequests Off
    ProxyVia Off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass http://internal:5000/
    ProxyPassReverse http://internal:5000/
    </VirtualHost>
    I can connect to name.dyndns-ip.com which points me to the internal:4040 correctly. However I can't connect to adm.name.dyndns-ip.com Does anyone know how to get this to work? I didn't edit any other config files.
    Last edited by sandyd; January 31st, 2013 at 11:22 PM. Reason: title

  2. #2
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: VirtualHost

    What happens when you try to navigate to adm.name.dyndns-ip.com?

    I suggest creating individual vhost files for each servername. This can make diagnosing and maintenance easier. With individual vhost files you can enable and disable on site at a time.

    For sites on the same machine you should use localhost, like:

    Code:
    ProxyPass http://localhost:5000/
    ProxyPassReverse http://localhost:5000/
    You should not need to duplicate servername and serveralias when they are equal.

    One other setting which can help when forwarding to another machine is to perserve the url with:

    Code:
    ServerName yoursever
    Serveralias www.yourserver
    ProxyPreserveHost on

    I suggest you move:

    Code:
    NameVirtualHost *:80
    to /etc/apache2/ports.conf

    Also you should not need the following in your vhost file. These are global mods loaded once with "sudo a2enmod proxy" or similar.
    Code:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    Last edited by volkswagner; January 31st, 2013 at 01:24 AM.
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  3. #3
    Join Date
    Oct 2011
    Beans
    9

    Re: VirtualHost

    The error I get when I navigate is: Server not found. The same error I would get if I just typed in random stuff. I changed the internal:5000 to localhost:5000 but no succes I can get one of the 2 to work, but not both. For instance if I remove the adm. at localhost:5000 it works, but then I have to remove the internal:4040 port forward...
    EDIT: adding preservehost to the script doesn't change anything either. My script is now:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName name.dyndns-ip.com
    ServerAlias name.dyndns-ip.com
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyVia Off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass / http://internal:4040/
    ProxyPassReverse / http://internal:4040/
    </VirtualHost>

    <VirtualHost *:80>
    ServerName name.dyndns-ip.com
    ServerAlias www.name.dyndns-ip.com
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyVia Off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass / http://localhost:5000/
    ProxyPassReverse / http://localhost:5000/
    </VirtualHost>
    I couldn't find the ports.conf, I'm using a synology which doesn't use ubuntu. Sorry for using this forum for it but I couldn't get any help elsewhere.
    Last edited by TooNick; January 31st, 2013 at 10:04 PM.

  4. #4
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: VirtualHosts and Synology NAS

    moved to other os talk
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

  5. #5
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: VirtualHosts and Synology NAS

    Have you tried moving your hosts to individual files?

    Here is an example of my vhost file. This does not change the port but adding the port should not affect the function.

    I also have in /etc/apache2/mods-enabled:
    proxy.conf
    proxy_http.load
    proxy.load




    Code:
    <VirtualHost *>
            ServerAdmin eric@domain.com
            ServerName server2.domain.com
            ServerAlias www.server2.domain.com
            ProxyPreserveHost on
             <location />
              allow from all
         </location>
    
    
            ProxyPass / http://192.168.7.61/
            ProxyPassReverse / http://192.168.7.61/
    
    </VirtualHost>
    This works for Apache2 passing to IIS and other apache2 servers on the LAN.

    I suggest trying individual vhost files.
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  6. #6
    Join Date
    Oct 2011
    Beans
    9

    Re: VirtualHosts and Synology NAS

    Thanks for your reply, I tried your code but didn't work. The problem might be tht I apperently have 2 modems ( i didn't know before, because I am not the owner of the modems...). However I did get it to work using ip.com/subsonic/ and ip.com/synology but now I can't login via browsers, but via apps is works fine though...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •