Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 15741  / 3 Years ago, wed, september 1, 2021, 3:34:47

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.


More From » apache2

 Answers
2

It appears that your Windows drive D is mounted at /media/Files



In that case, your files are actually in /media/Files/Files/web_files. Please try editing the default sites-available file with that path, restart Apache with sudo service apache2 restart and see if it works.



Additionally, as Marty notes in the comments, it appears Nautilus mounts NTFS partitions with odd permissions so that no user but yourself (and root, of course) can read or write from/to it.



To solve that, close all Nautilus windows, stop apache2, open a terminal and do the following:




sudo umount /dev/sda3
mkdir /media/DriveD
sudo ntfs-3g /dev/sda3 /media/DriveD



Now start apache2 and see if it works. If it does, it's best to put the mount in /etc/fstab as Marty noted.



If you don't want to edit your /etc/fstab file, do this




  • Open a terminal and type



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



I suppose, your partition was already labeled as "Files". In this case, it will be mounted to /media/Files directory. Then you can execute php files in them. But if it is not labeled as "Files", I recommend to do so by using disk-utility. Or if you prefer not labeling, change your etc/apache2/sites-available/default file, to the actual mount point.



Note: If you do not have a label with the partition, It will get mounted in /media/xxxx.... folder, where xxxx... is the UUID of the partition.



Credit goes to this answerer


[#36853] Wednesday, September 1, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hentor

Total Points: 482
Total Questions: 104
Total Answers: 111

Location: South Korea
Member since Sun, Dec 25, 2022
1 Year ago
;