Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.