Error 500 ubuntu index.php setting
Looks like you have a couple of items to look at in the fullstack1.conf
file:
-
Your
DocumentRoot
should point to the directory that visitors to the site will start from which, based on the<Directory>
entity, should be:/var/www/html/fullstack1/public
-
The final slash in the
<Directory>
entity is unnecessary:<Directory /var/www/html/fullstack1/public>
-
If you are running a modern version of Apache, these two lines can be removed from the
<Directory>
entity:Order allow,deny Allow from all
These permission statements are now handled with the
Require
statements. -
If Apache does not know what to serve when people visit the bare domain, it will default to showing the directory structure or present an error. As you’re running a PHP-based site, you can add this line immediately after
DocumentRoot
:DirectoryIndex index.php index.html index.htm
This will look first for
index.php
in the/public
directory and fail first toindex.html
if the PHP file does not exist, then toindex.htm
.
Once these items are taken care of, restart (or reload) the Apache server:
sudo service apache2 restart
This should give you what you need 👍🏻