Skip to content

Instantly share code, notes, and snippets.

@othmanalikhan
Last active December 20, 2023 06:04
Show Gist options
  • Save othmanalikhan/322f83a77c15dfd1c91a2afe0b6a6fc2 to your computer and use it in GitHub Desktop.
Save othmanalikhan/322f83a77c15dfd1c91a2afe0b6a6fc2 to your computer and use it in GitHub Desktop.
Installing BookStack (Debian 11) (2022-11)

Installation: Installing BookStack (Debian 11)

The following guide assumes running the commands below as root for simplicity. Later in the guide directory permissions are restricted to follow the principle of least privilege.

  1. Install dependencies.

    apt install -y git unzip apache2 php7.4 curl php7.4-fpm php7.4-curl php7.4-mbstring php7.4-ldap \
    php7.4-tidy php7.4-xml php7.4-zip php7.4-gd php7.4-mysql libapache2-mod-php7.4 \
    default-mysql-server
    
  2. Setup database.

    # You can manually define the password below or autogenerate it.
    DB_PASS="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13)"
    
    # TODO: Consider moving away from 'mysql_native_password' to a more secure authentication mechanism.
    mysql -u root --execute="CREATE DATABASE bookstack;"
    mysql -u root --execute="CREATE USER 'bookstack'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
    mysql -u root --execute="GRANT ALL ON bookstack.* TO 'bookstack'@'localhost';FLUSH PRIVILEGES;"
    

    QA: Running mysql -u root --execute="SELECT user FROM mysql.user" should show the created user 'bookstack'.

  3. Install PHP package manager.

    # Install composer
    EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
    
    if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
    then
        >&2 echo 'ERROR: Invalid composer installer checksum'
        rm composer-setup.php
        exit 1
    fi
    
    php composer-setup.php --quiet
    rm composer-setup.php
    
    # Move composer to global installation
    mv composer.phar /usr/local/bin/composer
    

    QA: Running composer about should output some text.

  4. Download BookStack PHP webapp files.

    cd /var/www
    git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch bookstack
    cd bookstack
    
  5. Define BookStack environment variables (Change BASE_URL value below!).

    # Change the BASE_URL value to either an IP or hostname. See the three examples below (delete all except one BASE_URL)
    BASE_URL=http://bookstack.mydomain.com
    BASE_URL=http://192.168.1.1:6875
    BASE_URL=http://localhost
    
    # Copy and update BookStack environment variables
    cp .env.example .env
    
    sed -i.bak "s@APP_URL=.*\$@APP_URL=$BASE_URL@" .env
    sed -i.bak 's/DB_DATABASE=.*$/DB_DATABASE=bookstack/' .env
    sed -i.bak 's/DB_USERNAME=.*$/DB_USERNAME=bookstack/' .env
    sed -i.bak "s/DB_PASSWORD=.*\$/DB_PASSWORD=$DB_PASS/" .env
    

    QA: Inspect the contents of the '.env' file and confirm that the four variables (APP_URL, DB_DATABASE, DB_USERNAME, DB_PASSWORD) have valid values.

  6. Configure BookStack.

    # Install BookStack composer dependencies
    export COMPOSER_ALLOW_SUPERUSER=1
    php /usr/local/bin/composer install --no-dev --no-plugins
    
    # Generate the application key
    php artisan key:generate --no-interaction --force
    # Migrate the databases
    php artisan migrate --no-interaction --force
    
    # Set file and folder permissions
    chown www-data:www-data -R bootstrap/cache public/uploads storage && chmod -R 755 bootstrap/cache public/uploads storage
    
  7. Configure Apache to serve new BookStack app.

    # Set up apache
    a2enmod rewrite
    a2enmod php7.4
    
    # Create apache config file to serve webapp
    vim /etc/apache2/sites-available/bookstack.conf
        <VirtualHost *:80>
                # Set the 'ServerName' to a static IP address unless you have a DNS entry for the hostname already.
                ServerName 10.10.10.100
                ServerAdmin webmaster@localhost
                DocumentRoot /var/www/bookstack/public/
            <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>
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
        </VirtualHost>
    
  8. Verify config file and enable it

    /usr/sbin/a2ensite bookstack.conf               # You need to enable it before using `apachectl configtest`
    /usr/sbin/apachectl configtest                  # You might see a `AH00558` warning message. It is safe to ignore (related to DNS lookup).
                                                    # The main thing to see is a `Syntax OK` message.
    /usr/sbin/a2dissite 000-default.conf            # Disable default website
    systemctl restart apache2
    
  9. Login into Bookstack: Browser > http://$BOOKSTACK_IP:80 > Login('admin@admin.com', 'password')

Common Issues

  • Problem: I messed up during the mysql steps and lost the password! How can I reset the password for the 'bookstack' user?
  • Solution: mysql -u root --execute="SET PASSWORD FOR 'bookstack'@'localhost' = PASSWORD('AWESOME_NEW_PASSWORD')"
@ludo453
Copy link

ludo453 commented Oct 15, 2022

Hello, I have an error during the last apache2 commands.

@othmanalikhan
Copy link
Author

othmanalikhan commented Oct 15, 2022

Greetings @ludo453, thanks for commenting. Can you elaborate further on the errors you are experiencing? A copy/paste of the error itself should be sufficient (or screenshot if that is easier).

Also to verify, I'm assuming you are installing BookStack on a Debian 11 machine?

@ludo453
Copy link

ludo453 commented Oct 15, 2022

hello it's planned I had to leave I'm redoing the installation.

@othmanalikhan
Copy link
Author

Fair enough, let me know if you encounter issues.

@ludo453
Copy link

ludo453 commented Oct 15, 2022

here is the error message :

root@BookStack:/var/www/bookstack# apachectl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
root@BookStack:/var/www/bookstack#

@othmanalikhan
Copy link
Author

othmanalikhan commented Oct 15, 2022

Though the line

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message`

looks like an error message, it is actually just a warning that can be safely ignored. The Syntax OK is the key part that confirms that your apache.conf file syntax is correct. So you can proceed with the next steps in the guide without issues.

The warning message is related to your Apache having issues resolving hostnames (DNS issues) for a particular entry. It won't pose an issue for the guide, but if you plan on eventually swapping to a hostname, say myAwesomeBookStackApp.com to resolve to your machine IP, then you might want to consider modifying your /etc/hosts file to add a static entry (a solution but might not be the best depending on your exact setup).

I've updated the guide to mention this and make it clearer. Thank you for taking the time and commenting!

@ludo453
Copy link

ludo453 commented Oct 15, 2022

it's good I found a line to modify in the file
line 2

bookstack.conf

@mariano-daniel
Copy link

mariano-daniel commented Oct 27, 2022

Hello! In my case I get:

Oct 27 03:32:35 instance-2 apachectl[19643]: AH00526: Syntax error on line 2 of /etc/apache2/sites-enabled/bookstack.c>
Oct 27 03:32:35 instance-2 apachectl[19643]: ServerName takes one argument, The hostname and port of the server
Oct 27 03:38:09 instance-2 apachectl[19679]: Action 'start' failed.
Oct 27 03:38:09 instance-2 apachectl[19679]: The Apache error log may have more information.
Oct 27 03:38:09 instance-2 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE

I have tried all different possibilities I can think of (FQDN, private ip, public ip) on ServerName 10.10.10.100 I'm stuck in here.

PS: Yes, I did try to add the port number with a :8080 and also space 8080 but nothing.
PS2: I googled to no avail, no one seems to be having the exact same issue as I do. And if they do, they get it resolved by simply adding the port number. I wonder what's wrong... Maybe my Firewall on the Gcloud machine? Shouldn't be an issue though.
PS3: Apache error logs don't say much:

cat /var/log/apache2/error.log 
[Thu Oct 27 03:05:09.343622 2022] [mpm_prefork:notice] [pid 16646] AH00163: Apache/2.4.54 (Debian) configured -- resuming normal operations
[Thu Oct 27 03:05:09.343701 2022] [core:notice] [pid 16646] AH00094: Command line: '/usr/sbin/apache2'
[Thu Oct 27 03:07:47.237238 2022] [mpm_prefork:notice] [pid 16646] AH00171: Graceful restart requested, doing restart
[Thu Oct 27 03:07:47.356656 2022] [mpm_prefork:notice] [pid 16646] AH00163: Apache/2.4.54 (Debian) configured -- resuming normal operations
[Thu Oct 27 03:07:47.356690 2022] [core:notice] [pid 16646] AH00094: Command line: '/usr/sbin/apache2'
[Thu Oct 27 03:15:41.021066 2022] [mpm_prefork:notice] [pid 16646] AH00169: caught SIGTERM, shutting down

@othmanalikhan
Copy link
Author

@mariano-daniel Greetings. If you are fine with posting the entire contents of your Apache config file then I can reproduce the issue locally on my machine and try to fix it. It might be a spacing/tab issue.

@mariano-daniel
Copy link

mariano-daniel commented Oct 27, 2022

Hello @othmanalikhan ! Surely.

/etc/apache2/apache2.conf
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#	/etc/apache2/
#	|-- apache2.conf
#	|	`--  ports.conf
#	|-- mods-enabled
#	|	|-- *.load
#	|	`-- *.conf
#	|-- conf-enabled
#	|	`-- *.conf
# 	`-- sites-enabled
#	 	`-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#Mutex file:${APACHE_LOCK_DIR} default

#
# The directory where shm and other runtime files will be stored.
#

DefaultRuntimeDir ${APACHE_RUN_DIR}

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
	Options FollowSymLinks
	AllowOverride None
	Require all denied
</Directory>

<Directory /usr/share>
	AllowOverride None
	Require all granted
</Directory>

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

#<Directory /srv/>
#	Options Indexes FollowSymLinks
#	AllowOverride None
#	Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
	Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/etc/apache2/sites-enabled/bookstack.conf
<VirtualHost *:80>
            ServerName 10.10.10.100:80 # Set to static IP otherwise define hostname in DNS entry for it to work.
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/bookstack/public/
        <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>
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

@othmanalikhan
Copy link
Author

othmanalikhan commented Oct 27, 2022

No worries.

As for the error, I was able to reproduce it and found what the error was. You will need to remove the comment on line 2 out. It seems Apache config files doesn't support comments in the same line as the actual code/syntax.

So the below is invalid:

 ServerName 10.10.10.100:80 # Set to static IP otherwise define hostname in DNS entry for it to work.

But this one is correct:

 ServerName 10.10.10.100:80

Thanks for reporting this. I will be updating the guide to reflect this!

P.S. I've modified your post to be collapsible for future readers. First time for me collapsing things too. It seems here is the cheatsheet: https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab

@mariano-daniel
Copy link

mariano-daniel commented Oct 28, 2022

Thanks for the snipet/collapsible tip/link @othmanalikhan ! I will definitely give it a lot of use now that I'm more active on github, so I honestly really appreciate it.

You were right indeed, Apache2 wasn't liking the comment on the same line as the argument.

Now I am able to restart Apache2 without problems, however, Bookstack is still unavailable. πŸ˜• No error message or anything. Just blank.
Apache2 error and access logs show nothing. Although there were some remainders from some previous access that shown the browser was able to pull the favicon.ico from Bookstack, and that was all I was seeing from the website. As soon as I cleared the logs and restarted everything, it was gone.

Do you know if there's anywhere else I can dig into logs to hopefully debug what is going on? Keep in mind I'm running this on a Gcloud VM. Thanks again for all the help! And please, if you have a buymeacoffee account, pass it on so I can thank you for your help a bit more! :)

EDIT: Yep, seems that when I bind the public IP of my GCloud instance, I get some response, but not the one we're looking for; here's the logs for Apache2 access.log:

tail -f /var/log/apache2/access.log 
[What seems to be a Linode Public IP Hmmm πŸ€”] - - [28/Oct/2022:01:09:54 +0000] "\x16\x03\x01" 400 486 "-" "-"
[My Public IP] - - [28/Oct/2022:01:17:23 +0000] "GET / HTTP/1.1" 500 185 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15"

EDIT2: Nevermind the Linode ip address. I forgot Gcloud VMs get bombarded with probes from πŸ€–

EDIT3: I will redo the VM and see if it works.

EDIT4: Redone it, not it's even worse 🀣 Now I access the pub_ip and Apache appends a www. to my ip. This is the output of Apache error log with debug level:

tail -f /var/log/apache2/error.log 
[Fri Oct 28 01:55:58.887621 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of Require all granted: granted
[Fri Oct 28 01:55:58.887678 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of <RequireAny>: granted
[Fri Oct 28 01:55:58.887874 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of Require all granted: granted
[Fri Oct 28 01:55:58.887882 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of <RequireAny>: granted

EDIT5: Welp, messing around with the .env file didn't seem to help either. My question being: Can I use an ip address in APP_URL?

EDIT6: All over again from scratch. Will redo the VM and try yet again. 😰

EDIT7: sigh I gave up and went with Wiki.js. Hope one day I can resolve the issues with Bookstack and get it to work!

@ColonelBlimp
Copy link

ColonelBlimp commented Nov 9, 2022

Hi, I followed your steps and all seemed to go well. However, when I create a new book, I get a 'Page Not Found' and the URL that looks like this:

http://192.168.1.3/http:/books/mead/chapter/mandarin-mead

Notice the 'http:' in the path. Any ideas what has caused this?
I have checked over the apache conf and it seems fine...

Just to add another comment, the 'Return to home' link is as above...

@ColonelBlimp
Copy link

Hi, I followed your steps and all seemed to go well. However, when I create a new book, I get a 'Page Not Found' and the URL that looks like this:

http://192.168.1.3/http:/books/mead/chapter/mandarin-mead

Notice the 'http:' in the path. Any ideas what has caused this? I have checked over the apache conf and it seems fine...

Just to add another comment, the 'Return to home' link is as above...

Okay, just found the problem. I needed to define a domain within the .env file...

@othmanalikhan
Copy link
Author

othmanalikhan commented Nov 9, 2022

Ye, that should have been done automatically in Step 5 with sed but I recall once or twice I had an issue with that. Perhaps when I get some time later I will update the guide to include common issues and solutions. Thanks for posting.

Edit 1: Improved the script for the .env section.

@othmanalikhan
Copy link
Author

Thanks for the snipet/collapsible tip/link @othmanalikhan ! I will definitely give it a lot of use now that I'm more active on github, so I honestly really appreciate it.

You were right indeed, Apache2 wasn't liking the comment on the same line as the argument.

Now I am able to restart Apache2 without problems, however, Bookstack is still unavailable. πŸ˜• No error message or anything. Just blank. Apache2 error and access logs show nothing. Although there were some remainders from some previous access that shown the browser was able to pull the favicon.ico from Bookstack, and that was all I was seeing from the website. As soon as I cleared the logs and restarted everything, it was gone.

Do you know if there's anywhere else I can dig into logs to hopefully debug what is going on? Keep in mind I'm running this on a Gcloud VM. Thanks again for all the help! And please, if you have a buymeacoffee account, pass it on so I can thank you for your help a bit more! :)

EDIT: Yep, seems that when I bind the public IP of my GCloud instance, I get some response, but not the one we're looking for; here's the logs for Apache2 access.log:

tail -f /var/log/apache2/access.log 
[What seems to be a Linode Public IP Hmmm πŸ€”] - - [28/Oct/2022:01:09:54 +0000] "\x16\x03\x01" 400 486 "-" "-"
[My Public IP] - - [28/Oct/2022:01:17:23 +0000] "GET / HTTP/1.1" 500 185 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15"

EDIT2: Nevermind the Linode ip address. I forgot Gcloud VMs get bombarded with probes from πŸ€–

EDIT3: I will redo the VM and see if it works.

EDIT4: Redone it, not it's even worse 🀣 Now I access the pub_ip and Apache appends a www. to my ip. This is the output of Apache error log with debug level:

tail -f /var/log/apache2/error.log 
[Fri Oct 28 01:55:58.887621 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of Require all granted: granted
[Fri Oct 28 01:55:58.887678 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of <RequireAny>: granted
[Fri Oct 28 01:55:58.887874 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of Require all granted: granted
[Fri Oct 28 01:55:58.887882 2022] [authz_core:debug] [pid 19418] mod_authz_core.c(815): [client 181.XX.185.XX:25342] AH01626: authorization result of <RequireAny>: granted

EDIT5: Welp, messing around with the .env file didn't seem to help either. My question being: Can I use an ip address in APP_URL?

EDIT6: All over again from scratch. Will redo the VM and try yet again. 😰

EDIT7: sigh I gave up and went with Wiki.js. Hope one day I can resolve the issues with Bookstack and get it to work!

@mariano-daniel How is Wiki.js going for you? Hopefully the deployment process was more straightforward than BookStack.

Apologies for the late reply, I had plans on deploying BookStack on a GCloud instance to verify the issues you are experiencing when I got more free time (which is right now) but it seems that Google Cloud Platform keeps rejecting my payment method.

In case you ever do come back to deploying BookStack, below are some things you can try to isolate whether the issue is from BookStack config itself or the GCloud config is to try the following:

  • To isolate any public routing/networking issues: After deploying BookStack on GCloud, try accessing the BookStack URL via the same machine using curl (e.g. curl -k localhost:80).
  • To isolate issues related to Apache: Try accessing the default Apache website that comes with Apache by default (you might need to re-enable it). First try accessing it locally via curl, then via a remote machine on the internet (e.g. your PC).

And lastly, thanks for sharing the buymeacoffee website! A very interesting website, wasn't aware of it. I appreciate the gesture and that is more than enough for me. πŸ‘

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