bitnami / vms

Bitnami VMs
https://bitnami.com
Other
200 stars 44 forks source link

[WordPress] use Apache status module "mod_status.so". Latest AWS Bitnami EC2 Wordpress Apache Image. #1491

Closed marcus-sm8a closed 1 month ago

marcus-sm8a commented 2 months ago

Platform

AWS

bndiagnostic ID know more about bndiagnostic ID

d1d0db01-5d88-c766-fd4e-1ef6c6e4fb13

bndiagnostic output

===== Begin of bndiagnostic tool output =====

✓ Processes: No issues found
✓ Mariadb: No issues found
? Connectivity: Found possible issues
✓ Php: No issues found
? Apache: Found possible issues
? Resources: Found possible issues
✓ Wordpress: No issues found

[Connectivity]

Server ports 22, 80 and/or 443 are not publicly accessible. Please check the following guide to open server ports for remote access:

https://docs.bitnami.com/general/faq/administration/use-firewall/

[Apache]

Press [Enter] to continue: Found recent error or warning messages in the Apache error log.

[Thu Apr 18 00:59:39.677154 2024] [proxy_fcgi:error] [pid 40773:tid 
139900481423040] [client **ip_address**:26280] AH01071: Got error 'PHP message: 
PHP Warning: Undefined array key "HTTP_X_FORWARDED_PROTO" in 
/bitnami/wordpress/wp-config.php on line 103'
 [Thu Apr 18 00:59:56.081968 2024] [proxy_fcgi:error] [pid 41437:tid 
139900296783552] [client **ip_address**:2824] AH01071: Got error 'PHP message: 
PHP Warning: Undefined array key "HTTP_X_FORWARDED_PROTO" in 
/bitnami/wordpress/wp-config.php on line 103'
 [Thu Apr 18 01:00:09.694977 2024] [proxy_fcgi:error] [pid 41436:tid 
139899726407360] [client **ip_address**:45170] AH01071: Got error 'PHP message: 
PHP Warning: Undefined array key "HTTP_X_FORWARDED_PROTO" in 
/bitnami/wordpress/wp-config.php on line 103'

Please check the following guide to troubleshoot server issues:

https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-erro rs-apache/

[Resources]

Press [Enter] to continue: Your instance has little available RAM memory.

 total used free shared buff/cache available Mem: 3883 1443 520 47 2221 2440 
Swap: 0 0 0

You could try to increase your instance's memory. Please check your cloud provider's documentation for more information.

===== End of bndiagnostic tool output =====

bndiagnostic was not useful. Could you please tell us why?

Using AWS Application Load Balancer

Describe your issue as much as you can

I am trying to use the server-status module by apache, we are trialing apache monitoring software via New Relic, this monitoring requires this mod_status module running via apache.

I have been unable to successfully get this page working "server-status". at most it tells me "Forbidden" when I try to access "/server-status"

New relic client doesn't seem to support the Bitnami modified apache configuration as original folders moved etc by bitnami.

I am slightly unclear where I need to put the following information to enable "server-status" The information below is it for the bitnami.conf file or the https.conf file? or under the .conf files under the "vhosts" directory.

<Location "/server-status"> SetHandler server-status Require host example.com

But I suspect that I am missing something else?

Are you guys able to push me in the right direction to enable "server-status" for your wordpress images? or do you not recommend enabling this for security reasons?

We are also currently trailing this Wordpress setup behind an application load balancer, so the SSL termination is completed on the ALB, and only HTTP 80 is sent to wordpress, no certificate is installed on the VM. this seems to work ok, but I am getting a notice in the apache error logs below

Got error 'PHP message: PHP Warning: Undefined array key "HTTP_X_FORWARDED_PROTO" in /bitnami/wordpress/wp-config.php on line 103'.

this seems to be in reference to the following entry in the wp-config file lines 103 and 104 are below

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) $_SERVER['HTTPS']='on';

Are you guys able to push me in the right direction, is something else not being declared?

This for your help as always.

jotamartos commented 2 months ago

I am slightly unclear where I need to put the following information to enable "server-status" The information below is it for the bitnami.conf file or the https.conf file? or under the .conf files under the "vhosts" directory.

<Location "/server-status"> SetHandler server-status Require host example.com But I suspect that I am missing something else?

Are you guys able to push me in the right direction to enable "server-status" for your wordpress images? or do you not recommend enabling this for security reasons?

As WordPress is set to work at the root path of your domain, all requests will be redirected to the application. If you want to redirect/manage those requests to /server-status differently, you will need to edit the wordpress and wordpress-https files under the vhosts directory.

We are also currently trailing this Wordpress setup behind an application load balancer, so the SSL termination is completed on the ALB, and only HTTP 80 is sent to wordpress, no certificate is installed on the VM. this seems to work ok, but I am getting a notice in the apache error logs below

There is an old guide here that explains how to configure this with the WordPress solution. However, paths were not updated with the new directory structure.

https://docs.bitnami.com/aws/how-to/configure-elb-ssl-aws/

/opt/bitnami/apps/APPNAME/conf/httpd-prefix.conf would be both wordpress and wordpress-https conf files under the vhosts folder and /opt/bitnami/apps/wordpress/htdocs/wp-config.php is at /opt/bitnami/wordpress/wp-config.php.

angela683h commented 2 months ago

Thanks for sharing this bug it's very helpful for my student education purpose....

compassmobile.dollartree.com

brandon698sherrick commented 2 months ago

The server-status module is a useful tool for monitoring Apache’s performance and is enabled via the mod_status module. The configuration snippet you’ve provided should be placed in the Apache configuration file. For Bitnami stacks, this is typically located in the bitnami.conf file or the httpd-app.conf file within the vhosts directory. The exact location can vary, but these are common places to look. Replace yourdomain.com with your actual domain and your.server.ip.address with the IP address of your server. This will restrict access to the server-status page to requests coming from your domain or server IP.

The warning in the Apache error log indicates that the HTTP_X_FORWARDED_PROTO server variable is not set. This variable is often used to determine if the request was made over HTTPS when behind a load balancer or reverse proxy that handles SSL termination. This will prevent the warning and ensure that the HTTPS server variable is set correctly when the HTTP_X_FORWARDED_PROTO header is present and set to ‘https’ on ky kynect.

github-actions[bot] commented 1 month ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 1 month ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.