## Installation

### Installing webwork as a subdomain?

by Alasdair McAndrew -
Number of replies: 2
In order to remove conflict with my wordpress installation, I've decided to have webwork as a subdomain, under Ubuntu 14.04 server.

All I should need to do is to add a file in my /etc/apache2/sites-available folder called webwork.conf, which includes something like:

<VirtualHost *:80>
ServerName webwork.myserver.net
DocumentRoot /opt/webwork/webwork2
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I then used a2ensite to enable this subdomain, and restarted apache2.

But I get the message

You don't have permission to access / on this server.

and the reason is that apache looks for an index file (index.html, index.php, index.cgi or whatever) in the root folder of the subdomain. And there isn't such a file in /opt/webwork/webwork2.

Note that the server webwork.myserver.net exists: I set it up with my webhosting people, and ping confirms its existence.

I just need the directory in DocumentRoot to point to something that apache2 can serve up.

Thanks,
Alasdair

### Re: Installing webwork as a subdomain?

by Danny Glin -
Unfortunately because of the way WeBWorK is structured, this might not be simple.

WeBWorK is built in such a way that all pages are served via perl handlers, and not through actual html or php files.  When you navigate to a webwork URL, apache intercepts it, and runs some perl code compiled into the apache process to generate the page.

The first implication is that there isn't a DocumentRoot for WeBWorK.  If you want a workaround, you can set up a dummy DocumentRoot directory which redirects to /webwork2/, then the perl should kick in and serve the appropriate page.

Because WeBWorK code is compiled directly into the apache processes, I suspect that even if you set up virtual hosts they will all serve WeBWorK pages if you navigate to /webwork2/.  It may be possible to specify perl handlers for only certain virtual hosts, but this would involve some messing with httpd.conf and webwork-apache2.conf.

Danny

### Re: Installing webwork as a subdomain?

by Alasdair McAndrew -

In actual fact I worked it out: in the virtual host file, I need to include the extra line which sources the necessary config file, thus:

<VirtualHost *:80>
ServerName webwork.myserver.net
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog${APACHE_LOG_DIR}/access.log combined
$server_root_url = "http://webwork.myserver.net"; This means that the url for accessing webwork is http://webwork.myserver.net/webwork2 but that's OK, even though it would have been nice not to have to have the extra webwork2 at the end. (I tried changing the value of$webwork_url to "", but that didn't work.)