I'm a beginner in Ubuntu hoping to find a better web development environment than WIndows. I'm trying to access http://localhost
but its always giving me a forbidden error. I've installed php, mysql, and apache separately. Files/web_files
is also my web directory in windows which when I access on windows is D:/Files/web_files
and on ubuntu is media/Files/web_files
. I also restart apache after editing the default
file located in etc/apache2/sites-available
Am I editing the wrong file? Please help.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /media/Files/web_files
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /media/Files/web_files/>
Options FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Update
If I used var/www
instead it works like magic.
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>
Here's the output from the mount
command
/dev/loop0 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/dev/sda2 on /host type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/wern/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=wern)
/dev/sr0 on /media/2022_21092011 type udf (ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,umask=0077)
/dev/sda3 on /media/Files type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sda1 on /media/System Rese
And here's the output from ls - laR/media
ls: cannot access -: No such file or directory
ls: cannot access laR: No such file or directory
/media:
2022_21092011 Files System Reserved
So I'm wondering if this is an issue in the filesystem or its permissions. But I don't think it has something to do with permissions since I can perfectly edit the files in media/Files/web_files
without having to run it as a superuser.
Thanks for those who has taken their time to help me so far.
/media/Files
? – ish Jul 15 '12 at 03:36/var/www
is owned by root, and the group is root; the group permissions are the same as the permissions for everyone, and there is no mention of "www-data" anywhere. The directories in /media seem to have the exact same permissions as /var/www. – Marty Fried Jul 15 '12 at 05:02ls -l /var/www
andls -l /media/Files
you will see that/media/Files
is only accessible for owner, but www is accessible by others as well – Manula Waidyanatha Jul 15 '12 at 05:07/media/Files
. I only have ext4 partitions available for /media, and they have the same permissions as /var/www. But this is why I suggested he explicitly mount the drive, so he could set the permissions to exactly what he needs. – Marty Fried Jul 15 '12 at 05:13sudo mount -a
, and it will mount everything in /etc/fstab. If there is an error, you will see it right away, and have a chance to fix it or disable it. – Marty Fried Jul 15 '12 at 05:59/mnt/somedirectory
rather than/media/
, but I think it will work if you make sure it's not currently mounted by the system, then create the directory and mount it. But if it were my system, I'd mount it in /mnt, and change the apache config file to match. – Marty Fried Jul 15 '12 at 06:07