Since I want to learn more around hosting a REST API and also development of such (with PHP) I am wondering about the following:
I’ve got my API files in the path /var/myapi and configured the directory like this:
<Directory /var/myapi>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
The Virtual Host is configured like this:
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /var/myapi/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
In my api directory I want to have the index.php is my router. So, the $_SERVER["REQUEST_URI"]
should contain the full path the client is requesting.
Unfortunately, when accessing http://localhost:8080/books the path /books
will be handled by apache which is trying to find a file in /var/msapi/books
. The path “/books` will not be reflected within my routers PHP code.
I think I somehow need to change settings in Apache but do not know what to look for. Any advice?