404 error when trying to open anything except the /public folder #811

Closed
opened 2026-02-04 22:21:39 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @ghost on GitHub (Sep 14, 2018).

Hello everyone,

Recently I setup Bookstack and followed all the instructions on the bookstack website (https://www.bookstackapp.com/docs/admin/installation/)

I was able to login when I opened the index.php in the public folder but I can‘t view my profile or or do anything else because I always get the message that the requested url was not found.

Which makes sense because I don‘t see a lot folders in the /public folder.

Did I forget something?

I can‘t seem to figure out where my error is.

Originally created by @ghost on GitHub (Sep 14, 2018). Hello everyone, Recently I setup Bookstack and followed all the instructions on the bookstack website (https://www.bookstackapp.com/docs/admin/installation/) I was able to login when I opened the index.php in the public folder but I can‘t view my profile or or do anything else because I always get the message that the requested url was not found. Which makes sense because I don‘t see a lot folders in the /public folder. Did I forget something? I can‘t seem to figure out where my error is.
OVERLORD added the 🐕 Support label 2026-02-04 22:21:39 +03:00
Author
Owner

@Abijeet commented on GitHub (Sep 16, 2018):

Hey @DJMcMuffin0

Sorry to hear that you are having trouble.

Did you by chance miss this step?

Set the web root on your server to point to the BookStack public folder. This is done with the root setting on Nginx or the DocumentRoot setting on Apache.

I'd also like you to check / answer the following,

  1. mod_rewrite is enabled and working.
  2. Is BookStack at the root folder, have you set APP_URL option in the .env file properly?

Can you also give us some more details regarding your server and setup?

@Abijeet commented on GitHub (Sep 16, 2018): Hey @DJMcMuffin0 Sorry to hear that you are having trouble. Did you by chance miss this step? > Set the web root on your server to point to the BookStack public folder. This is done with the root setting on Nginx or the DocumentRoot setting on Apache. I'd also like you to check / answer the following, 1. mod_rewrite is enabled and working. 2. Is BookStack at the root folder, have you set `APP_URL` option in the `.env` file properly? Can you also give us some more details regarding your server and setup?
Author
Owner

@ghost commented on GitHub (Sep 17, 2018):

Hey @Abijeet,

sorry for replying so late. Thank you for your help.

I made sure that mod_rewrite is enabled. Is there a way to check if it is actually working?

The DocumentRoot wasn‘t set to /var/www/bookstack/

I also tried setting the APP_URL in the .env file because I have a couple other things running on that server as well.

Right now the DocumentRoot is back to normal. Just /var/www/

The server is not reachable from the internet. (Only internally)

I set the APP_URL to http://192.168.1.10/bookstack/

1b76c9a7-a4a3-436c-8832-cc2a60f2db76

@ghost commented on GitHub (Sep 17, 2018): Hey @Abijeet, sorry for replying so late. Thank you for your help. I made sure that mod_rewrite is enabled. Is there a way to check if it is actually working? The DocumentRoot wasn‘t set to /var/www/bookstack/ I also tried setting the APP_URL in the .env file because I have a couple other things running on that server as well. Right now the DocumentRoot is back to normal. Just /var/www/ The server is not reachable from the internet. (Only internally) I set the APP_URL to http://192.168.1.10/bookstack/ ![1b76c9a7-a4a3-436c-8832-cc2a60f2db76](https://user-images.githubusercontent.com/41778355/45643879-f8ea2c80-ba70-11e8-898c-10889ccaa877.jpeg)
Author
Owner

@lommes commented on GitHub (Sep 20, 2018):

Since the document root should point to the public directory, your APP_URL needs to include the public folder (http://192.168.1.10/bookstack/public/) and you need to add a RewriteBase to the .htaccess-file in the public directory. Im not sure but I think something like the following should help

RewriteEngine On # should already be there
RewriteBase /bookstack/public/
#rest of existing htaccess file

Please keep in mind the you should not use BookStack like this in a production environment because all files in the folders are exposed to the web. Everyone can download your http://192.168.1.10/bookstack/.env file and see your database credentials.

@lommes commented on GitHub (Sep 20, 2018): Since the document root should point to the public directory, your APP_URL needs to include the public folder (http://192.168.1.10/bookstack/public/) and you need to add a RewriteBase to the .htaccess-file in the public directory. Im not sure but I think something like the following should help ``` RewriteEngine On # should already be there RewriteBase /bookstack/public/ #rest of existing htaccess file ``` **Please keep in mind the you should not use BookStack like this in a production environment because all files in the folders are exposed to the web. Everyone can download your http://192.168.1.10/bookstack/.env file and see your database credentials.**
Author
Owner

@ghost commented on GitHub (Sep 20, 2018):

I did everything you said. I edited the .env file and corrected the APP_URL. I also edited the .htaccess-file in the public folder.

I still get redirected to http://192.168.1.10/bookstack/public/login when I try to open http://192.168.1.10/bookstack/public/ and then I receive a 404 error.

65cfce25-af4d-4978-8caa-9272e230901e
ecc0d95b-6430-4b32-b5dd-af1235490892

@ghost commented on GitHub (Sep 20, 2018): I did everything you said. I edited the .env file and corrected the APP_URL. I also edited the .htaccess-file in the public folder. I still get redirected to http://192.168.1.10/bookstack/public/login when I try to open http://192.168.1.10/bookstack/public/ and then I receive a 404 error. ![65cfce25-af4d-4978-8caa-9272e230901e](https://user-images.githubusercontent.com/41778355/45838348-5e832680-bcc6-11e8-9717-31aaf06db133.jpeg) ![ecc0d95b-6430-4b32-b5dd-af1235490892](https://user-images.githubusercontent.com/41778355/45838349-5e832680-bcc6-11e8-9642-7aa3b8a975b0.jpeg)
Author
Owner

@lommes commented on GitHub (Sep 21, 2018):

Can you please provide us with the content of the webserver configuation for /var/www (should be somewhere like /etc/apache2/sites-enabled/000-default)

For mod_rewrite to work there needs to be atleast AllowOverride FileInfo instead of AllowOverride None in there.

@lommes commented on GitHub (Sep 21, 2018): Can you please provide us with the content of the webserver configuation for /var/www (should be somewhere like /etc/apache2/sites-enabled/000-default) For mod_rewrite to work there needs to be atleast `AllowOverride FileInfo` instead of `AllowOverride None` in there.
Author
Owner

@ghost commented on GitHub (Sep 21, 2018):

Thank you guys for helping me out 👍

Here is the 000-default.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        RedirectMatch ^/$ /bookstack/public/
</VirtualHost>
@ghost commented on GitHub (Sep 21, 2018): Thank you guys for helping me out 👍 Here is the 000-default.conf ``` <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RedirectMatch ^/$ /bookstack/public/ </VirtualHost> ```
Author
Owner

@ghost commented on GitHub (Sep 21, 2018):

I figured it out with the help of @lommes

I had to edit the apache2.conf file and add following lines

<Directory /var/www/bookstack/public/>
Options Indexes FollowSymLinks
AllowOverride All FileInfo
Require all granted
</Directory>

Thank you all for helping 👍

@ghost commented on GitHub (Sep 21, 2018): I figured it out with the help of @lommes I had to edit the apache2.conf file and add following lines ``` <Directory /var/www/bookstack/public/> Options Indexes FollowSymLinks AllowOverride All FileInfo Require all granted </Directory> ``` Thank you all for helping 👍
Author
Owner

@lommes commented on GitHub (Sep 22, 2018):

Glad you got it working!

But again the hint that you should not use this configuration in production! BookStack is designed to use an own domain with the DocumentRoot pointing to the public directory, so config files are not accessible in the browser.

@lommes commented on GitHub (Sep 22, 2018): Glad you got it working! But again the hint that you should not use this configuration in production! BookStack is designed to use an own domain with the DocumentRoot pointing to the public directory, so config files are not accessible in the browser.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#811