403 Forbidden clean apache2 install
Solution 1
Well, found the answer to my problem, albeit trying to help another user with a similar problem!
This question https://askubuntu.com/questions/343172/add-apache2-vhost-at-home gave a link that gave me a solution! I just had to run sudo chmod -R 755 /var/www
and now I can access it fine! Thanks for the help @Andrew, but I got this one myself!
Solution 2
First, add your user to the www-data
group.
sudo adduser [ your username ] www-data
Then, set ownership of /var/www/
to the www-data
group.
sudo chown [ your username ]:www-data /var/www
Finally, set permissions for the /var/www/
directory.
sudo chmod 777 /var/www
sudo chmod g+s /var/www
Hope this helps.
Related videos on Youtube
RPiAwesomeness
Socials Old Blog: Sudo'd Youtube Channel: AEVES Tech Rigs Desktop - Custom built, you can see the specs/build stuff here ThinkPad T540p #Skills Advanced: googlefu python Intermediate: gimp building-pcs c++ golang Acceptable: c# bash zsh rust java Absolutely No Clue: perl windows
Updated on September 18, 2022Comments
-
RPiAwesomeness over 1 year
I recently reinstalled Ubuntu and then installed the
lamp-server
bundle viatasksel
and the installation went fine.I had backed up the files from the
/var/www/
folder and planned to just place them back once the server was back online (or in my case, accesible from my computer only - it's a test server.)The installation completed and so I tried to copy the files over from the backup directory. This went fine.
However, when I try to access the server via
localhost
from Firefox I get a 403 Forbidden error, which I never had before. HELP!!EDIT: 9/2/2013 Added info about file happenings
So, I followed what @Andrew said, but I still can't access any .html files. Strangely enough, I can access the .php files (nothing displayed of course, as they only display the info pulled from a previously completed form.) But no html access, just the
Forbidden
You don't have permission to access /index.html on this server.
page
-
Admin about 10 yearsWhy did this work? It just worked for me.. can someone explain? I am a real hit and miss guy at this stuff, copying and pasting whatever I can... I know, I'm a nightmare.
-
-
RPiAwesomeness over 10 yearsI will try this out! Hopefully it fixes my problem!
-
RPiAwesomeness over 10 yearsWell, doing that gave me/www-data the ownership of /var/www, but...not the files inside. SO...I still can't access the server.
-
RPiAwesomeness over 10 yearsApparently I can access the .php files (nothing comes up of course), but not the .html files?
-
Nic over 9 years@RPi_Awesomeness Try putting
-R
just after thechown
, separated by spaces from everything else. I don't know if that'll work -- I don't have an Ubuntu reference on me, but it's common for commands to accept the-R
flag to recursively operate on every file and subdirectory within them. -
ShemSeger about 8 yearsAhhh... that feeling when things start going your way... +1
-
Martin Tournoij about 8 years
chmod 777
: nonononono! Never ever runchmod 777
. It is practically never required! Not even for "testing purposes". If the file is readable, then it's readable. If it's writable by theuser
orgroup
that need to write to it, then it's writable. There is absolutely zero need to give everyone write permissions, and forgetting tochmod
it back to something sane is exactly how multinationals get hacked. Just don't do it. Ever. I wrote an introduction of Unix permissions. Please read it!