Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using BookStack in Subdirectory leads into "Page not found" #5045

Closed
twindscheif opened this issue Jun 2, 2024 · 3 comments
Closed

Using BookStack in Subdirectory leads into "Page not found" #5045

twindscheif opened this issue Jun 2, 2024 · 3 comments
Labels

Comments

@twindscheif
Copy link

Describe the Bug

First of all: I love BookStack and i already installed several instances using default parameters.
In this case i need to use a Subdirectory for the first time.

Installed a fresh BookStack v24.05.1-instance on latest Ubuntu Server 24 LTS with Install-Script.
If accessing the Subdirectory it fails with "Page not found."
Without using Subdirectory it works, which means, i can logon and work within BookStack.

Target URL: http://portal.mydomain.local/bookstack
Bookstack Install-Path: /var/www/bookstack

When using subdirectory (/bookstack) like used in the configuration example (https://www.bookstackapp.com/docs/admin/subdirectory-setup/)
i'm redirected to /bookstack/login and always get "Page not found"-Error.

image

/var/www/bookstack/.env

# This file, when named as ".env" in the root of your BookStack install
# folder, is used for the core configuration of the application.
# By default this file contains the most common required options but
# a full list of options can be found in the '.env.example.complete' file.

# NOTE: If any of your values contain a space or a hash you will need to
# wrap the entire value in quotes. (eg. MAIL_FROM_NAME="BookStack Mailer")

# Application environment
# Can be 'production', 'development', 'testing' or 'demo'
APP_ENV=production

# Sets application language to english
APP_LANG=en

#disable auto language
APP_AUTO_LANG_PUBLIC=false

# Application key
# Used for encryption where needed.
# Run `php artisan key:generate` to generate a valid key.
APP_KEY=base64:<Removed for Security>

# Application URL
# This must be the root URL that you want to host BookStack on.
# All URLs in BookStack will be generated using this value
# to ensure URLs generated are consistent and secure.
# If you change this in the future you may need to run a command
# to update stored URLs in the database. Command example:
# php artisan bookstack:update-url https://old.example.com https://new.example.com
APP_URL=http://portal.mydomain.local/bookstack

# Database details
DB_HOST=localhost
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=<Removed for Security>

Installed Apache modules:
sudo a2enmod ssl
sudo a2enmod headers
sudo a2enmod rewrite

/etc/apache2/sites-available/bookstack.conf

<VirtualHost *:80>

        ServerName portal.mydomain.local
        DocumentRoot /var/www/bookstack/public/

    # BookStack Configuration
    Alias "/bookstack" "/var/www/bookstack/public"

    <Directory "/var/www/bookstack/public">
      Options FollowSymlinks
      AllowOverride None
      Require all granted

      RewriteEngine On
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)/$ /$1 [L,R=301]

      # Handle Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
    </Directory>


    <Directory "/var/www/bookstack">
      AllowOverride None
      Require all denied
    </Directory>
    # End BookStack Configuration

        ErrorLog error.log
        CustomLog access.log combined

</VirtualHost>

Restarted apache service via
sudo systemctl restart apache2

Cleared Browser Cache

Steps to Reproduce

  1. Browse http://portal.mydomain.local/bookstack with Firefox

Expected Behaviour

If accessing the main page http://portal.mydomain.local/bookstack i expect to see the login-page of BookStack

Screenshots or Additional Context

No response

Browser Details

Firefox 126 on Windows Server 2019

Exact BookStack Version

v24.05.1

@ssddanbrown
Copy link
Member

Hi @twindscheif,
Within your /etc/apache2/sites-available/bookstack.conf file, can you update the DocumentRoot /var/www/bookstack/public/ option so the path is in a completely different location to the BookStack setup? (Do not use the /var/www/bookstack/ path at all, so something like /var/www/other-folder/).
Then restart apache and check again.

@twindscheif
Copy link
Author

Hi @ssddanbrown,

you are a genius :). After Changing the DocumentRoot to another folder outside the BookStack-installation (or even comment out DocumentRoot) it works perfectly.

Thank you so much

@ssddanbrown
Copy link
Member

Good to hear that worked, and thanks for the support and PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants