Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a virtuoso sparql endpoint installed, which I want to make available through a hostname (e.g. 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 <> 
    ServerAlias <> 

    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


share|improve this question
up vote 4 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 *>

  ProxyRequests Off
  ProxyPass / http://localhost:1234/
  ProxyPassReverse / http://localhost:1234/

See the apache documentation for more details.

Note that if you want 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


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.