How to set JS source directory in apache2?

Posted by highBandWidth on Server Fault See other posts from Server Fault or by highBandWidth
Published on 2011-01-13T21:28:46Z Indexed on 2011/01/13 21:55 UTC
Read the original article Hit count: 390

Filed under:
|
|

I am trying to run a very basic webserver for development/debugging. The static HTML seems to be delivered correctly, but it seems that the JavaScript libraries are not being delivered to the browser. The page HTML says something like

<html>
<head>
  <script type='text/javascript' src="/lib/json.js"></script>
...

Now, I have set up a link for /lib/ in my httpd.conf as:

Scriptalias /lib/ "/SomeFolder/lib/"

When I do this, it can't fetch the files because this is what I see in my apache error log:

... [error] [client ::1] client denied by server configuration: /SomeFolder/lib/json.js, referer: http://localhost/SomeSite

It seems that apache is not allowing access to the folder, so I add this to httpd.conf:

Directory "/SomeFolder/lib/">
    Allow from all
</Directory>

After this, browsing the page still does not run the JS, instead I see the following error in my apache error log:

[error] [client ::1] (13)Permission denied: exec of '/SomeFolder/lib/json.js' failed, referer: http://localhost/SomeSite

So now, it seems that apache is trying to run the JS files on the server like a cgi script or something. But I have not made that folder a cgi-bin folder. The only lines where SomeFolder is mentioned by name is in these lines in httpd.conf:

Scriptalias /lib/ "/SomeFolder/lib/"
Directory "/SomeFolder/lib/">
    Allow from all
</Directory>

© Server Fault or respective owner

Related posts about apache2

Related posts about httpd.conf