0

I have a virtuoso sparql endpoint installed, which I want to make available through a hostname (e.g. www.virtuosoexample.com). The thing with virtuoso is that the is no Document root. The endpoint is initiated by the daemon and made available through a source port (e.g. localhost:1234/)

I know how to set a virtual host pointing to a document root, but i don't know how to do this for a server with a port number.

Any advice would be appreciated.

Below is the code, how I would do it with a document root.

I tried to change that (naively) into localhost:1234/sparql, but that didn't work

<VirtualHost *>

   ServerName www.virtuosoexample.com <www.virtuosoexample.com> 
    ServerAlias www.virtuosoexample.com <www.virtuosoexample.com> 

    ErrorLog /var/log/apache2/error.wp-sparql.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.wp-sparql.log combined


    DocumentRoot /var/www/endpoint/sparql/
    <Directory /var/www/endpoint/sparql>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory> 

</VirtualHost>

msanford
  • 1,477
  • 15
  • 28
Andra
  • 103
  • 5

2 Answers2

4

You would not do this by mucking with Apache's DocumentRoot. Instead, you would use mod_proxy and set up Apache as a reverse proxy.

You would add something like:

ProxyPass / http://localhost:1234/sparql
ProxyPassReverse / http://localhost:1234/sparql

to your configuration. Make sure mod_proxy is loaded by Apache.

Here is the official documentation.

cjc
  • 24,916
  • 3
  • 51
  • 70
3

You can use mod_proxy for this. For example:

NameVirtualHost *

<VirtualHost *>
  ServerName www.virtuosoexample.com

  ProxyRequests Off
  ProxyPass / http://localhost:1234/
  ProxyPassReverse / http://localhost:1234/
</VirtualHost>

See the apache documentation for more details.

Note that if you want http://www.virtuosoexample.com/ to be proxied to http://localhost:1234/sparql, that you may encounter some problems if the links returned by virtuoso are not relative links. If so, you may consider using mod_proxy_html or mod_substitute

brain99
  • 1,792
  • 12
  • 19