I just installed ubuntu desktop (because I figured server will be too much for me, and apparently I was right) and I'm trying to configure my apache web server but unfortunately it has nothing to do with the way I'm used to configuring it on windows.

I installed the package lamp-server^ which supposedly packs php and mysql as well but I haven't even got to those yet.

After I installed the package and went to http://localhost I saw the default welcoming page, so far so good. However I want to move the root folder from /var/www/html to /home/user/www/html since I didn't really know how much space to give these partitions and I gave home significantly more space. To do this I would have to edit httpd.conf but there is no such file on the system. After a brief research I found that I have to edit /etc/apache2/sites-available/000-default.conf which is a virtual server, I guess. So I edited it like so

ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/user/www/html

Not only am I continuing to get this annoying message

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message

Additionally I'm getting 403 access denied when I try to access http://localhost

I have been looking for solutions on the web as well as on the lamp page but I just can't seem to get things right, it's very exhausting..


As the error message says, try setting ServerName localhost in the main server context, that is, outside of a VirtualHost container. To do that, put the directive in a file e.g. /etc/apache2/conf-available/servername.conf, then run a2enconf servername to enable it, and restart apache with service apache2 restart.

As for the 403 error, /home/user/www/html probably isn't readable by the www-data user. To test that, try setting chmod a+rx /home /home/user /home/user/www /home/user/www/html, and see if the 403 goes away. But note that these are broader permissions than you normally want to set. For a more permanent set of permissions for apache, see What permissions should my website files/folders have on a Linux webserver?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.