Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Im running Ubuntu 12.04 LTS on a system with 2 GB RAM and a 500 GB HDD.

My hard drive has 4 partitions:

  • Partition 1 = 40 gb Windows (NTFS, lable = win32)
  • Partition 2 = 320 gb Windows (FAT label = common)
  • Partition 3 = 40 gb Ubuntu (EXT4)

I installed apached2. Then, to change its default www directory, I ran gksu gedit /etc/apache2/sites-enabled/000-default and, in the editor, changed the location to /media/common/www.

After that I ran these commands in a terminal:

chmod 777 /media/common/www 
chmod 777 /media/common/www/*.*

After that I ran: firefox 127.0.0.1/index.php

It said:

Forbidden
You don't have permission to access / on this server.
Apache/2.2.22 (Ubuntu) Server at 127.0.0.1 Port 80

Before my changes it was working fine.

How can I run my websites?

share|improve this question
    
It seems I have jeopardized myself by the my short knowledge, and community being unable to help as 16 hours are more than enough for experts like you, even google results are not helping me. WHAT NEXT ... –  user72878 Jun 24 '12 at 4:29
2  
Not all questions are answered the day they are posted. You can check out other Ubuntu help resources, but whether or not you decide to use some of those resources now, I counsel patience. Most of us "experts" have lives outside of Ask Ubuntu, school/jobs, and other commitments. We're volunteers who may or may not be able to respond quickly to assist you or anyone else (and you'll find that's the case for the other free support resources too). If that doesn't work for you, you might consider buying support. –  Eliah Kagan Jun 25 '12 at 3:09
    
What do you expect to happen? Does index.php exists in that location? Or does not not exist, and you're hoping to see a virtual directory listing? –  Eliah Kagan Jun 25 '12 at 3:15
1  
To be or not to be, that is the question.... –  izx Jun 26 '12 at 5:37
    
@nishan Please consider accepting an answer, if your problem is solved by any one of them. This will help future visitors. Thanks –  Anwar Shah Jul 19 '12 at 18:06

2 Answers 2

I guess that, Your common partition may be an ntfs or fat partition and You just mounted that partition by clicking on the nautilus side bar icon. Doing so, does not mount the partition with executable permission, which is required for firefox to be able to execute the file.

The solution:

The easiest solution without using /etc/fstab file is this:

  • Open a terminal and type sudo blkid, give password.
  • From the output of the command, see the type of the partition by looking at the corresponding label, i.e common.
  • If common partition happen to be /dev/sda2 , mount that partition with the command:

    udisks --mount /dev/sda2 --mount-options umask=022  
    

    replace, /dev/sda2 with the actual partition number.

You should now be able to execute/run the files using "Firefox".

Note: You should unmount the partition before using the command. You can unmount it by right-clicking on the partition icon, and select "unmount" from the options

share|improve this answer
    
I have faced this problem and tested this method, which works. So, I wrote the solution. It is not necessary for you to agree with me. –  Anwar Shah Jun 26 '12 at 3:09
1  
@neon_overload, I suggest you to setup a web server with document root at a folder in ntfs partition. then mount the partition with nautilus, which mounts without exec permission. Then put some .php file in it, then try access to these files with Firefox. Then let me know what happened. Please, don't overload me with comments without actually you verified that this is not a real solution. I hope you will try this. –  Anwar Shah Jun 26 '12 at 3:43
    
I have tested this today. It is working exactly. –  Anwar Shah Jul 15 '12 at 7:53

Well, from what i can tell, chmod won't work on directories the way you use it- you really should try chmod -R 777 /path/to/main/directory/ to make it recursive. Then again, You don't want 777 for most things - but the exact permissions level would depend on your setup - I just hand over ownership to www-data and run things with 755 - which dosen't let non owners write, but gives full read/execute powers.

Amusingly the error messages should have given most of this away. For a better writeup on how to set permissions, see this question on webmasters.se

share|improve this answer
1  
I covered that and better permissions settings in my answer - the executable bit is for scripts to run - which as i recall, are run by www-data. 755 is what many scripts recommend, and came to mind. "the exact permissions level would depend on your setup" is a VERY important point here. –  Journeyman Geek Jun 26 '12 at 2:09
2  
Lets look at the bigger picture here - is he running static sites? He is running a php script, and that would indicate, no, he is running dynamic content through a PHP script. How do PHP scripts run? They need to be executed. What user executes files from PHP? I'm guessing www-data. The top voted answer to the question i referenced agree. You don't. citation needed xkcd.com/285 . –  Journeyman Geek Jun 26 '12 at 2:18
    
@neon_overload - if it's such a bad idea, i would think it wouldn't also be a component of your answer... –  hbdgaf Jun 26 '12 at 17:27

Your Answer

 
discard

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.