views:

739

answers:

4

I am using Linuxmint (= ubuntu linux 9.10) I installed LAmp server which have apache,php mysql and now i am trying to write jquery code i made a file and it worked perfectly with this link : file:///var/www/jquery/jquery.html
but when i use this link, then it doesnt work anymore : http://localhost/jquery/jquery.html

the file jquery.min.js is in the same folder and i already changed the src of it in source code to

  1. <script type="text/javascript" src="/var/www/jquery/jquery.min.js"></script>
  2. <script type="text/javascript" src="jquery.min.js"></script>

but none of them works (with localhost link) using firebug I saw these errors:

  1. The requested URL /var/www/jquery/jquery.min.js was not found on this server.
  2. You don't have permission to access /jquery/jquery.min.js on this server.

Apache/2.2.12 (Ubuntu) Server at localhost Port 80

so what do I have to do to make it run?

+1  A: 

The second approach should work, if the apache server has read access to file /var/www/jquery/jquery.min.js.

Victor Nicollet
+1  A: 

If apache's user is wwwrun and the group is www, do the following:

chmod -R 0744 /var/www/
chown -R wwwrun:www /var/www/

This will ensure, that the apache user will have the rights to view, execute, etc. the files in your web-folder.

stefita
On most *nix systems, commands can be case sensitive. It's not `Chmod`, it's `chmod`.
S Pangborn
Thanks, must've hit the shift, like writing a new sentence and overseen it.
stefita
A: 

You also need to make sure your Apache configuration allows you to serve js files.

Try to access http://localhost/jquery/jquery.min.js and see if you can get the file.

Benoit Vidis
A: 
when i access http://localhost/jquery/jquery.min.js 
I get this error
Forbidden
You don't have permission to access /jquery/jquery.min.js on this server.

oem-desktop oem # Chmod -R 0744 /var/www/
No command 'Chmod' found, did you mean:
 Command 'chmod' from package 'coreutils' (main)
Chmod: command not found
oem-desktop oem # chown -R wwwrun:www /var/www/
chown: invalid user: `wwwrun:www'
oem-desktop oem # 

??? do I have to install something ?
ace
Your system is probably case sensitive. Try `chown` rather than `Chown`. The second error occurs because the user wwwrun doesnt exist. Try `chown www-data:www-data /var/www`.
S Pangborn