Forum Moderators: phranque

Message Too Old, No Replies

Permission denied on javascript folder

         

daktau

10:52 am on Jan 19, 2010 (gmt 0)

10+ Year Member



Hi,
I have a virtual host set up and it is not loading in any javascript.

<script type="text/javascript" src="/javascript/alertTest.js"></script>

does not work.

Oddly, if I type

http://virtuaHostName/css/style.css

I can see the style sheet.

If I try

http://virtuaHostName/javascript/alertTest.js

I get a 404 not found.

If I try

http://virtuaHostName/css/

I get a list of the files contained in that folder as I have not denied directory listing.

If I try

http://virtuaHostName/javascript/

I get permission denied.

When I try to

ls -la
the website's document root all files and folders are owned by me and have the same permissions.

Does anyone know what is causing this?

thank you,
George

encyclo

1:30 pm on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I try
http://virtuaHostName/javascript/
I get permission denied.

This will probably be because there in no index file (index.html or similar) in that directory, and your configuration blocks the listing of the directory contents. This is not a problem in itself, in fact it's good practice.

If the server is running Linux or similar Unix-type OS (rather than Windows), then check the capitalization of your Javascript file. Linux is case-sensitive when it comes to file names, unlike Windows, so "alertTest.js" is not the same as "AlertTest.js" or "alerttest.js".

daktau

2:44 pm on Jan 19, 2010 (gmt 0)

10+ Year Member



Thanks for the reply. This however is not the case as apache lists the contents of the css folder (which contains only .css files) fine and I am aware that Unix systems are case sensitive and have made sure the casing is all correct.

This is happening in all the virtual hosts I have set up so I'm thinking that it is some module or setting in apache.

I have disabled the deflate mods in case they were affecting thing but this has made no difference.

Any help would be greatly appreciated.

cheers,
George

daktau

3:12 pm on Jan 19, 2010 (gmt 0)

10+ Year Member



In checking the error logs for th virtual host I've found this...

Directory index forbidden by Options directive: /usr/share/javascript/

How does one go about resolving this?

cheers,
George

jdMorgan

3:16 pm on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What operating system is your server running on?

Jim

encyclo

3:16 pm on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It looks like you may have an Alias set up for the directory
/javascript/
pointing to
/usr/share/javascript/
- so your
/javascript/
directory in your document-root is being bypassed/ignored. See:

[httpd.apache.org...]

If this is the case, either remove the alias in httpd.conf and then Apache will use your directory rather than the alias, or keep the alias but change the directory name of your

/javascript/
directory to something else.

daktau

3:22 pm on Jan 19, 2010 (gmt 0)

10+ Year Member



Thank you.

My httpd.conf file has nothing in it that I can see would alias javascript/

I checked the conf.d folder in apache and in there there is a file called javascript-common.conf which alias' javascript to /usr/share/javascript/

Once I'd commented out this file it all works as normal.

cheers,
George

encyclo

3:45 pm on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad that fixed it, I assume you're using Debian (or Ubuntu, which is based on Debian). This issue is noted as a bug here:

[bugs.debian.org...]

The suggestion there is to rename

/usr/share/javascript/
to
/usr/share/javascript-common/
(as root), then adjust the Alias in javascript-common.conf to point to the renamed directory. This depends of course what exactly resides in the shared javascript directory in the first place - it may not be required at all in your case.