Unable to connect to BookStack after changing host machine/server IP address. #4627

Closed
opened 2026-02-05 09:08:21 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @YID-C on GitHub (Apr 12, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hi all.

I found a tricky little "got ya" that I haven't seen documented so leaving this here. Easy fix but could be a brick wall if you don't think to check or know it's there.

I built a new instance of BookStack on a dedicated Ubuntu server, with a clean install of Ubuntu 22.04.4 LTS. Because I was testing and repeatedly wiping the install to ensure everything was fresh, I had my IP/Network settings set to automatic/DHCP.

Once I had everything up and running and ready to move to production, I assigned it a static IP address outside of my configured DHCP address range but still on my primary subnet. (Don't fret if you don't understand that, it's not relevant to the issue).

Once I had assigned the static IP using a free address and restarted ubuntu, my server came back up with the new settings as expected, however BookStack was now completely unreachable. Every time I put my servers local IP address into the address bar, it would redirect me to the old DHCP issued address. I tried in incognito mode and cleared my local windows machines' DNS cache, with the same results.

Oddly enough, I connected to the ubuntu server directly and navigated to both the new ip address and also tried just "localhost" in firefox, with the same result.

It turns out, while my server IP address had updated, BookStack has a configuration that doesn't automatically update. This makes sense when you want it on a domain name, but for me this is a local server only meant to be accessible on my LAN and so want it using an IPv4 address.

To correct the issue, all we need to do is update the .env file. To do this, open a terminal window on your ubuntu (or whatever your host server is) and navigate into your bookstack folder. By default this should be /var/www/bookstack. Use this command in terminal:

cd /var/www/bookstack

Now "/var/www/bookstack" should be to the left of the cursor indicating you're in the correct directory. Now run the command:

sudo nano .env

If you run into a password/permissions issue you may still be able to edit the file without super user permissions, so if the above command doesn't work just try:

nano .env

Whichever command you use, this will open BookStacks' .env file in ubuntus' command line text editor (nano). Use the arrow keys to scroll down a few lines and you should see "APP_URL=" and then your old IP address. Backspace the previous address and replace it with your new static IP address.

Once you've done that, press "CTRL+X" to exit. You'll be prompted to save, press "y" for yes, and you'll be prompted to type a name for the file. It should have ".env" entered already so just hit enter.

In my case, I went back to my web browser and entered the new static ip address and it worked right away. You might need to restart first though so just be aware.

Here's a screenshot of the value you're looking for with my details blacked out.
Screenshot_4459

Hope that helps!

My versions:

Ubuntu 22.04.4 LTS
PHP Version: 8.1.2-1ubuntu2.14
BookStack Version: v24.02.3
Apache/2.4.52 (Ubuntu)

Exact BookStack Version

v24.02.3

Log Content

No response

Hosting Environment

Ubuntu 22.04.4 LTS
PHP Version: 8.1.2-1ubuntu2.14
BookStack Version: v24.02.3
Apache/2.4.52 (Ubuntu)

Originally created by @YID-C on GitHub (Apr 12, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Hi all. I found a tricky little "got ya" that I haven't seen documented so leaving this here. Easy fix but could be a brick wall if you don't think to check or know it's there. I built a new instance of BookStack on a dedicated Ubuntu server, with a clean install of Ubuntu 22.04.4 LTS. Because I was testing and repeatedly wiping the install to ensure everything was fresh, I had my IP/Network settings set to automatic/DHCP. Once I had everything up and running and ready to move to production, I assigned it a static IP address outside of my configured DHCP address range but still on my primary subnet. (Don't fret if you don't understand that, it's not relevant to the issue). Once I had assigned the static IP using a free address and restarted ubuntu, my server came back up with the new settings as expected, however BookStack was now completely unreachable. Every time I put my servers local IP address into the address bar, it would redirect me to the old DHCP issued address. I tried in incognito mode and cleared my local windows machines' DNS cache, with the same results. Oddly enough, I connected to the ubuntu server directly and navigated to both the new ip address and also tried just "localhost" in firefox, with the same result. It turns out, while my server IP address had updated, BookStack has a configuration that doesn't automatically update. This makes sense when you want it on a domain name, but for me this is a local server only meant to be accessible on my LAN and so want it using an IPv4 address. To correct the issue, all we need to do is update the .env file. To do this, open a terminal window on your ubuntu (or whatever your host server is) and navigate into your bookstack folder. By default this should be /var/www/bookstack. Use this command in terminal: `cd /var/www/bookstack` Now "/var/www/bookstack" should be to the left of the cursor indicating you're in the correct directory. Now run the command: `sudo nano .env` If you run into a password/permissions issue you may still be able to edit the file without super user permissions, so if the above command doesn't work just try: `nano .env` Whichever command you use, this will open BookStacks' .env file in ubuntus' command line text editor (nano). Use the arrow keys to scroll down a few lines and you should see "APP_URL=" and then your old IP address. Backspace the previous address and replace it with your new static IP address. Once you've done that, press "CTRL+X" to exit. You'll be prompted to save, press "y" for yes, and you'll be prompted to type a name for the file. It should have ".env" entered already so just hit enter. In my case, I went back to my web browser and entered the new static ip address and it worked right away. You might need to restart first though so just be aware. Here's a screenshot of the value you're looking for with my details blacked out. ![Screenshot_4459](https://github.com/BookStackApp/BookStack/assets/166672041/ab58cfe3-631c-4eaa-be11-292f460caa7d) Hope that helps! My versions: Ubuntu 22.04.4 LTS PHP Version: 8.1.2-1ubuntu2.14 BookStack Version: v24.02.3 Apache/2.4.52 (Ubuntu) ### Exact BookStack Version v24.02.3 ### Log Content _No response_ ### Hosting Environment Ubuntu 22.04.4 LTS PHP Version: 8.1.2-1ubuntu2.14 BookStack Version: v24.02.3 Apache/2.4.52 (Ubuntu)
OVERLORD added the 🐕 Support label 2026-02-05 09:08:21 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4627