/login 404 error on new install #4383

Closed
opened 2026-02-05 08:44:48 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @geoffschultz on GitHub (Dec 31, 2023).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I just did a fresh install of BookStack on a Raspberry Pi running Raspian V10 with Apache 2.4.38. PHP 8.2 is installed. The DocumentRoot is set to /var/www/bookstack/public. The server resides at https://bookstack.freshstartfurniturebank.org/ and
you can phpinfo results at https://bookstack.freshstartfurniturebank.org/sysinfo.php (I'll remove this when resolved)

When I try to access https://bookstack.freshstartfurniturebank.org/ I get a 404 error with https://bookstack.freshstartfurniturebank.org/login as the ending URL. Looking at the apache server logs, I see:

File does not exist: /var/www/bookstack/public/login

If I use https://bookstack.freshstartfurniturebank.org/index.php/login as the URL, I get to the login page, but then end up back in the 404 error when I try to log in.

The .htaccess files are as provided, and as shown in the sysinfo page above, mode rewrite is available.

Any help would be greatly appreciated, as I'm the retired IT guy for this volunteer-based non-profit, and am trying to get this done over the Christmas/New Year break.

Exact BookStack Version

23.12

Log Content

File does not exist: /var/www/bookstack/public/login

Hosting Environment

Raspberry Pi running Raspian V10 with Apache 2.4.38. PHP 8.2 is installed

Originally created by @geoffschultz on GitHub (Dec 31, 2023). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I just did a fresh install of BookStack on a Raspberry Pi running Raspian V10 with Apache 2.4.38. PHP 8.2 is installed. The DocumentRoot is set to /var/www/bookstack/public. The server resides at https://bookstack.freshstartfurniturebank.org/ and you can phpinfo results at [https://bookstack.freshstartfurniturebank.org/sysinfo.php](https://bookstack.freshstartfurniturebank.org/sysinfo.php) (I'll remove this when resolved) When I try to access https://bookstack.freshstartfurniturebank.org/ I get a 404 error with https://bookstack.freshstartfurniturebank.org/login as the ending URL. Looking at the apache server logs, I see: File does not exist: /var/www/bookstack/public/login If I use https://bookstack.freshstartfurniturebank.org/index.php/login as the URL, I get to the login page, but then end up back in the 404 error when I try to log in. The .htaccess files are as provided, and as shown in the sysinfo page above, mode rewrite is available. Any help would be greatly appreciated, as I'm the retired IT guy for this volunteer-based non-profit, and am trying to get this done over the Christmas/New Year break. ### Exact BookStack Version 23.12 ### Log Content File does not exist: /var/www/bookstack/public/login ### Hosting Environment Raspberry Pi running Raspian V10 with Apache 2.4.38. PHP 8.2 is installed
OVERLORD added the 🐕 Support label 2026-02-05 08:44:48 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 31, 2023):

Hi @geoffschultz,
Can you share the apache virtualhost config you used?

@ssddanbrown commented on GitHub (Dec 31, 2023): Hi @geoffschultz, Can you share the apache virtualhost config you used?
Author
Owner

@geoffschultz commented on GitHub (Dec 31, 2023):

Hi @geoffschultz, Can you share the apache virtualhost config you used?

This isn't a virtual host.

@geoffschultz commented on GitHub (Dec 31, 2023): > Hi @geoffschultz, Can you share the apache virtualhost config you used? This isn't a virtual host.
Author
Owner

@ssddanbrown commented on GitHub (Dec 31, 2023):

@geoffschultz Okay, can you share the apache config you applied for the BookStack instance?

@ssddanbrown commented on GitHub (Dec 31, 2023): @geoffschultz Okay, can you share the apache config you applied for the BookStack instance?
Author
Owner

@geoffschultz commented on GitHub (Dec 31, 2023):

<IfModule mod_ssl.c>
<VirtualHost *:443>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName bookstack.freshstartfurniturebank.org

	ServerAdmin geoff@freshstartfurniturebank.org
	DocumentRoot /var/www/bookstack/public

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	LogLevel info ssl:info

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

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf


ServerName bookstack.freshstartfurniturebank.org
SSLCertificateFile /etc/letsencrypt/live/bookstack.freshstartfurniturebank.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/bookstack.freshstartfurniturebank.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
@geoffschultz commented on GitHub (Dec 31, 2023): ```apache <IfModule mod_ssl.c> <VirtualHost *:443> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName bookstack.freshstartfurniturebank.org ServerAdmin geoff@freshstartfurniturebank.org DocumentRoot /var/www/bookstack/public # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. LogLevel info ssl:info ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf ServerName bookstack.freshstartfurniturebank.org SSLCertificateFile /etc/letsencrypt/live/bookstack.freshstartfurniturebank.org/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/bookstack.freshstartfurniturebank.org/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> ```
Author
Owner

@ssddanbrown commented on GitHub (Dec 31, 2023):

Thanks.
Okay, so there's probably nothing to direct requests to the index file.
This could be done by the .htaccess but use of those is often considered bad practice and disabled by default.
Best to add the required config to your apache config.

Add the following to your VirtualHost config for BookStack:

	<Directory /var/www/bookstack/public/>
		Options Indexes FollowSymLinks
		AllowOverride None
		Require all granted
		<IfModule mod_rewrite.c>
			<IfModule mod_negotiation.c>
				Options -MultiViews -Indexes
			</IfModule>

			RewriteEngine On

			# Handle Authorization Header
			RewriteCond %{HTTP:Authorization} .
			RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

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

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

You'll likely need to restart apache afterwards for changes to take place.

@ssddanbrown commented on GitHub (Dec 31, 2023): Thanks. Okay, so there's probably nothing to direct requests to the index file. This could be done by the `.htaccess` but use of those is often considered bad practice and disabled by default. Best to add the required config to your apache config. Add the following to your VirtualHost config for BookStack: ```apache <Directory /var/www/bookstack/public/> Options Indexes FollowSymLinks AllowOverride None Require all granted <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> ``` You'll likely need to restart apache afterwards for changes to take place.
Author
Owner

@geoffschultz commented on GitHub (Jan 1, 2024):

Thank you! That solved the problem. This is basically equivalent to the .htaccess file. What's the difference?

@geoffschultz commented on GitHub (Jan 1, 2024): Thank you! That solved the problem. This is basically equivalent to the .htaccess file. What's the difference?
Author
Owner

@ssddanbrown commented on GitHub (Jan 1, 2024):

Good to hear that solved it.
Both of those are ways to define config, although keeping it all in apache config files keeps it all in a predictable place that can't be altered by others, rather than .htaccess files which can end up being dynamic with potential for security issues where config can altered/manage by the app and app-level vulnerabilities.

@ssddanbrown commented on GitHub (Jan 1, 2024): Good to hear that solved it. Both of those are ways to define config, although keeping it all in apache config files keeps it all in a predictable place that can't be altered by others, rather than `.htaccess` files which can end up being dynamic with potential for security issues where config can altered/manage by the app and app-level vulnerabilities.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4383