Caddy reverse proxy, results in text of index.php #3797

Closed
opened 2026-02-05 07:30:10 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @ThePrivatePanda on GitHub (May 10, 2023).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I have caddy pre-installed and running for quite a while now, and I used that to forward the request to apache (I'm not very great at these terminologies, please bear with me.) The problem is, it simply displays the contents of the index.php file.
image

It is to be hosted on kb.privatepanda.co. I have an ubuntu 22.04 AWS EC2 instance where it is to be hosted, and I have made an A record on cloudflare pointing to the AWS instance. Caddy picks up the request, and sends it to the port apache is listening on.
Caddy config/CaddyFile

kb.privatepanda.co {
	reverse_proxy localhost:9999
}

Apache ports config: (/etc/apache2/ports.conf)

Listen 9999

<IfModule ssl_module>
	Listen 443
</IfModule>

<IfModule mod_gnutls.c>
	Listen 443
</IfModule>

Both config files in sites-available and sites-enabled start with <VirtualHost *:9999>. Full file contents:
https://paste.privatepanda.co/BYCjRCGF
https://paste.privatepanda.co/xFyYCng4

I have installed it using the installation script. Since there is no website to check the settings view, I am unsure of the version - but I attempted this less than 24 hours ago so it should have pulled the latest version.
I'd appreciate any help and please let me know if there are any other details I need to share, Thanks!

Exact BookStack Version

v23.05.1 (porobably)

Log Content

/var/www/bookstack/storage/logs/laravel.log and /var/log/nginx/error.log do not exist
contents of /var/log/apache2/error.log:

[Tue May 09 19:18:25.466900 2023] [core:notice] [pid 197535:tid 139707961575296] AH00094: Command line: '/usr/sbin/apache2'
[Tue May 09 19:29:54.290801 2023] [mpm_event:notice] [pid 197535:tid 139707961575296] AH00492: caught SIGWINCH, shutting down gracefully
[Tue May 09 19:30:22.159611 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations
[Tue May 09 19:30:22.160400 2023] [core:notice] [pid 197905:tid 140518245984128] AH00094: Command line: '/usr/sbin/apache2'
[Tue May 09 19:32:05.315403 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00493: SIGUSR1 received.  Doing graceful restart
[Tue May 09 19:32:05.324013 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations
[Tue May 09 19:32:05.324028 2023] [core:notice] [pid 197905:tid 140518245984128] AH00094: Command line: '/usr/sbin/apache2'
[Wed May 10 08:17:08.694687 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00492: caught SIGWINCH, shutting down gracefully
[Wed May 10 08:18:35.910463 2023] [mpm_event:notice] [pid 201896:tid 140102552840064] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations
[Wed May 10 08:18:35.911462 2023] [core:notice] [pid 201896:tid 140102552840064] AH00094: Command line: '/usr/sbin/apache2'

PHP Version

8.1.2

Hosting Environment

Ubuntu 22.04 VPS from AWS EC2, installed using installation script.
Domain is secured with cloudflare with A record pointing to VPS public ip.

Originally created by @ThePrivatePanda on GitHub (May 10, 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 have caddy pre-installed and running for quite a while now, and I used that to forward the request to apache (I'm not very great at these terminologies, please bear with me.) The problem is, it simply displays the contents of the index.php file. ![image](https://github.com/BookStackApp/BookStack/assets/86164003/179e7bc2-3ede-468b-af1a-9d929649ddf4) It is to be hosted on `kb.privatepanda.co`. I have an ubuntu 22.04 AWS EC2 instance where it is to be hosted, and I have made an A record on cloudflare pointing to the AWS instance. Caddy picks up the request, and sends it to the port apache is listening on. Caddy config/CaddyFile ```Caddyfile kb.privatepanda.co { reverse_proxy localhost:9999 } ``` Apache ports config: (`/etc/apache2/ports.conf`) ``` Listen 9999 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule> ``` Both config files in sites-available and sites-enabled start with `<VirtualHost *:9999>`. Full file contents: https://paste.privatepanda.co/BYCjRCGF https://paste.privatepanda.co/xFyYCng4 I have installed it using the installation script. Since there is no website to check the settings view, I am unsure of the version - but I attempted this less than 24 hours ago so it should have pulled the latest version. I'd appreciate any help and please let me know if there are any other details I need to share, Thanks! ### Exact BookStack Version v23.05.1 (porobably) ### Log Content `/var/www/bookstack/storage/logs/laravel.log` and `/var/log/nginx/error.log` do not exist contents of `/var/log/apache2/error.log`: ```[Tue May 09 19:18:25.466795 2023] [mpm_event:notice] [pid 197535:tid 139707961575296] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations [Tue May 09 19:18:25.466900 2023] [core:notice] [pid 197535:tid 139707961575296] AH00094: Command line: '/usr/sbin/apache2' [Tue May 09 19:29:54.290801 2023] [mpm_event:notice] [pid 197535:tid 139707961575296] AH00492: caught SIGWINCH, shutting down gracefully [Tue May 09 19:30:22.159611 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations [Tue May 09 19:30:22.160400 2023] [core:notice] [pid 197905:tid 140518245984128] AH00094: Command line: '/usr/sbin/apache2' [Tue May 09 19:32:05.315403 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00493: SIGUSR1 received. Doing graceful restart [Tue May 09 19:32:05.324013 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations [Tue May 09 19:32:05.324028 2023] [core:notice] [pid 197905:tid 140518245984128] AH00094: Command line: '/usr/sbin/apache2' [Wed May 10 08:17:08.694687 2023] [mpm_event:notice] [pid 197905:tid 140518245984128] AH00492: caught SIGWINCH, shutting down gracefully [Wed May 10 08:18:35.910463 2023] [mpm_event:notice] [pid 201896:tid 140102552840064] AH00489: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations [Wed May 10 08:18:35.911462 2023] [core:notice] [pid 201896:tid 140102552840064] AH00094: Command line: '/usr/sbin/apache2' ``` ### PHP Version 8.1.2 ### Hosting Environment Ubuntu 22.04 VPS from AWS EC2, installed using installation script. Domain is secured with cloudflare with A record pointing to VPS public ip.
OVERLORD added the 🐕 Support label 2026-02-05 07:30:10 +03:00
Author
Owner

@lommes commented on GitHub (May 10, 2023):

This usually happens when PHP is not activated in apache or the virtual host.

You might try running a2enmod php8.1 and systemctl restart apache2 manually and see if it works afterwards or you get any more usefull error message.

You should be able to access apache/bookstack using kb.privatepanda.co:9999 in your browser to see if it is a problem with apache or the proxy itself.

@lommes commented on GitHub (May 10, 2023): This usually happens when PHP is not activated in apache or the virtual host. You might try running `a2enmod php8.1` and `systemctl restart apache2` manually and see if it works afterwards or you get any more usefull error message. You should be able to access apache/bookstack using kb.privatepanda.co:9999 in your browser to see if it is a problem with apache or the proxy itself.
Author
Owner

@ThePrivatePanda commented on GitHub (May 10, 2023):

That worked perfectly! Thanks!

@ThePrivatePanda commented on GitHub (May 10, 2023): That worked perfectly! Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3797