Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LAMP] Redirect #1711

Closed
huzanf opened this issue Nov 14, 2024 · 16 comments
Closed

[LAMP] Redirect #1711

huzanf opened this issue Nov 14, 2024 · 16 comments
Assignees
Labels
lamp/mamp/wamp/xampp solved tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@huzanf
Copy link

huzanf commented Nov 14, 2024

Platform

AWS

bndiagnostic ID know more about bndiagnostic ID

36086671-560b-4dd1-d8af-0fb315c064a1

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

[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]

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

[Thu Nov 14 12:08:35.668233 2024] [authz_core:error] [pid 449295:tid 449409] 
[client **ip_address**:21802] AH01630: client denied by server configuration: 
/opt/bitnami/apache/cgi-bin

[Thu Nov 14 12:08:51.230515 2024] [autoindex:error] [pid 449295:tid 449368] 
[client **ip_address**:21802] AH01276: Cannot serve directory 
/opt/bitnami/FDU/wp-admin/css/colors/: No matching DirectoryIndex 
(index.html,index.html,index.htm,index.php) found, and server-generated 
directory index forbidden by Options directive

[Thu Nov 14 12:09:18.747108 2024] [autoindex:error] [pid 455806:tid 455892] 
[client **ip_address**:16242] AH01276: Cannot serve directory 
/opt/bitnami/FDU/wp-content/upgrade/: No matching DirectoryIndex 
(index.html,index.html,index.htm,index.php) found, and server-generated 
directory index forbidden by Options directive

Please check the following guide to troubleshoot server issues:

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

Press [Enter] to continue:
[Resources]

Your instance has little available RAM memory.

               total        used        free      shared  buff/cache   available
Mem:            1941        1264          69         192         983         677
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?

NA

Describe your issue as much as you can

Hi,

I recently setup a new website on my LAMP stack. I have also mapped the domain to my IP. However, when I hit the domain, for some reason it get's redirected to one of the other websites that is there on my server. Kindly assist.

@huzanf huzanf added the tech-issues The user has a technical issue about an application label Nov 14, 2024
@github-actions github-actions bot added the triage Triage is needed label Nov 14, 2024
@jotamartos
Copy link
Collaborator

jotamartos commented Nov 15, 2024

I recently setup a new website on my LAMP stack. I have also mapped the domain to my IP. However, when I hit the domain, for some reason it get's redirected to one of the other websites that is there on my server. Kindly assist.

That question is related to a custom configuration in your deployment. Please check all vhost files under /opt/bitnami/apache/conf/vhosts and ensure that they all configure the ServerName and ServerAlias parameters as needed. Also check if there is any redirection in place in those files.

@jotamartos jotamartos changed the title [<LAMP>] Redirect [LAMP] Redirect Nov 15, 2024
@huzanf
Copy link
Author

huzanf commented Nov 17, 2024

That question is related to a custom configuration in your deployment. Please check all vhost files under /opt/bitnami/apache/conf/vhosts and ensure that they all configure the ServerName and ServerAlias parameters as needed. Also check if there is any redirection in place in those files.

@jotamartos everything is set correctly. Would you like me to share screenshots?

@jotamartos
Copy link
Collaborator

You have many custom virtual hosts files in the instance, what's the domain with the problem? The output of this command should help you debug the issue.

curl -LI YOUR_DOMAIN_HERE

I can see you also have cloudflare in front of the deployment, you should review that configuration as well

$ curl -LI www.DOMAIN.org.in
HTTP/1.1 302 Found
Date: Mon, 18 Nov 2024 14:16:43 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Location: http://www.DOMAIN.org.in/wp-admin/setup-config.php
cf-cache-status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=xxxxxxxxxx"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8e4894791d63ec99-MAD
alt-svc: h3=":443"; ma=86400
server-timing: cfL4;desc="?proto=TCP&rtt=14491&sent=1&recv=3&lost=0&retrans=0&sent_bytes=0&recv_bytes=82&delivery_rate=0&cwnd=248&unsent_bytes=0&cid=0000000000000000&ts=0&x=0"

@huzanf
Copy link
Author

huzanf commented Nov 19, 2024

Thanks @jotamartos
Please find below the responses I got:
For
curl -LI mercury.org.in

HTTP/1.1 302 Found
Date: Tue, 19 Nov 2024 06:39:13 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Location: http://mercury.org.in/wp-admin/setup-config.php
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=JjfPUFmmSg%2Bdho%2BsBeLJDd6QHsmXOFzPn3B3StKwqGOJvwZXhWl1TX
OkXZ%2Bjbau01Ckm0wYnX6F5tGxpNuQ3w7V8niAudi166OaWzifQBEA%2BM3%2BJiWXSztviwQhxB6KI9e5JJC%2Bu3S38H31Ocg%3D%3D"}],"group":"cf-nel","max_age"
:604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8e4e33ac1b104442-BOM
alt-svc: h3=":443"; ma=86400
server-timing: cfL4;desc="?proto=TCP&rtt=1400&sent=1&recv=3&lost=0&retrans=0&sent_bytes=0&recv_bytes=79&delivery_rate=0&cwnd=30&unsent_b
ytes=0&cid=0000000000000000&ts=0&x=0"

HTTP/1.1 200 OK
Date: Tue, 19 Nov 2024 06:39:13 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=4eVRenGIMN8rpe6MOOoiY6QVNC26dYSxpfLSysvBv6bYyHg2YOgd81FlhO
jJqdEF%2BA0ke93QYP8HT4xHhy4uVcqnKRF4BCVTcd7mya5zLbZS5KaqgM69jsSp5YD9fTY35AZyVytTmBdcWOEk8A%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8e4e33ac7b4c4442-BOM
alt-svc: h3=":443"; ma=86400
server-timing: cfL4;desc="?proto=TCP&rtt=1822&sent=3&recv=5&lost=0&retrans=0&sent_bytes=812&recv_bytes=183&delivery_rate=282244&cwnd=31&
unsent_bytes=0&cid=0000000000000000&ts=0&x=0"

For
curl -LI www.mercury.org.in

HTTP/1.1 301 Moved Permanently
Date: Tue, 19 Nov 2024 06:38:51 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Redirect-By: WordPress
Location: https://www.fduindia.com/
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=A8zHgTGZeYxl
IhXuxDgzDYej1jpnRnRuVa8RSLc1RemnFkPYGXYitgMTICSb7L%2FeHgUpojm%2FqXeENV17MJvrWwIpG2bwM7rkXS
CuGNniRBr0jpgxzF%2FmNW3FVVwCTf2lJfMsrfO4JqJnB1GAV%2BqSA0g%3D"}],"group":"cf-nel","max_age"
:604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 8e4e33235cb74702-BOM
alt-svc: h3=":443"; ma=86400
server-timing: cfL4;desc="?proto=TCP&rtt=1430&sent=1&recv=3&lost=0&retrans=0&sent_bytes=0&
recv_bytes=83&delivery_rate=0&cwnd=30&unsent_bytes=0&cid=0000000000000000&ts=0&x=0"

HTTP/2 200 
date: Tue, 19 Nov 2024 06:38:51 GMT
content-type: text/html; charset=UTF-8
x-frame-options: SAMEORIGIN
link: <https://www.fduindia.com/wp-json/>; rel="https://api.w.org/", <https://www.fduindia
.com/wp-json/wp/v2/pages/4003>; rel="alternate"; title="JSON"; type="application/json", <h
ttps://www.fduindia.com/>; rel=shortlink
set-cookie: j192bjft=nor6jv9zbq7p; expires=Sun, 24 Nov 2024 06:38:51 GMT; Max-Age=432000; 
path=/; secure; HttpOnly
set-cookie: 7820915g=ajwhwnjvqgpn; expires=Sun, 24 Nov 2024 06:38:51 GMT; Max-Age=432000; 
path=/; secure; HttpOnly
cf-cache-status: DYNAMIC
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=mW4o%2FkCipY
KgI21cuBVWlmmzTyqHng7R3DiWQsIQ%2FUa4AOvV6mzZj1ueXI5J5sbVWChnNwrRpauswdztR0Xpi5FOVu6lYor9jy
e4irH4JZdTFiXegz3ycK4I2ChXXr2P0t4ilNo6jkjKuCRvSAUx"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 8e4e3324ff7c47bc-BOM
alt-svc: h3=":443"; ma=86400
server-timing: cfL4;desc="?proto=TCP&rtt=1592&sent=7&recv=10&lost=0&retrans=0&sent_bytes=3
411&recv_bytes=782&delivery_rate=2511801&cwnd=35&unsent_bytes=0&cid=22d45651fdd6ba90&ts=22
2&x=0"

For www.mercury.org.in not sure why it is redirecting.

@jotamartos
Copy link
Collaborator

It's WordPress what is redirecting your requests, please take a look at the WordPress configuration

HTTP/1.1 301 Moved Permanently
Date: Tue, 19 Nov 2024 06:38:51 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Redirect-By: WordPress
Location: https://www.fduindia.com/
...

@huzanf
Copy link
Author

huzanf commented Nov 27, 2024

Thanks @jotamartos
However, this is strange. As I setup my website just a few days ago. Not sure why WordPress is redirecting my request.
Any thing particular that I need to look at?

@jotamartos
Copy link
Collaborator

You will need to take a look at the wp-config.php file and any plugin you have that may be redirecting the requests.

@huzanf
Copy link
Author

huzanf commented Nov 30, 2024

Hi @jotamartos
There seems to be some issue. I changed my folder of the website.
The website is now just a simple HTML page. Now there website loads with www. and redirects when hit without www.

Below is the new BN Code:
72c71093-721e-8bdb-af2f-c24ad92ee754

I had one question. The 2 conf files located at /opt/bitnami/apache/conf/vhosts who should be the owner? Current it is setup as bitnami:bitnami. Should it be bitnami:root or root:root?

@jotamartos
Copy link
Collaborator

Please run the curl command to see what is redirecting you to the non-www domain. If you get redirected, please take a look at the vhosts files to see which one is performing the redirection.

curl -LI DOMAIN

I had one question. The 2 conf files located at /opt/bitnami/apache/conf/vhosts who should be the owner? Current it is setup as bitnami:bitnami. Should it be bitnami:root or root:root?

bitnami:bitnami is fine. Apache runs as daemon, you can also use bitnami:daemon if required.

@huzanf
Copy link
Author

huzanf commented Dec 2, 2024

Please run the curl command to see what is redirecting you to the non-www domain. If you get redirected, please take a look at the vhosts files to see which one is performing the redirection.

Hi @jotamartos
I tried to do this and noticed that the URL with www is redirecting. Attached is the https-vhosts file.

@jotamartos
Copy link
Collaborator

jotamartos commented Dec 3, 2024

Hi @huzanf,

I can see WordPress is still redirecting the request

HTTP/1.1 301 Moved Permanently
Date: Tue, 03 Dec 2024 09:38:32 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Redirect-By: WordPress
Location: https://www.fdu***.com/

That means that the requests to mer****.org.in goes to a WordPress site which is configured with the other domain. If that request shouldn't go to that WordPress, please take a look at all vhosts files and configure the ServerName and ServerAlias liens properly. If that WordPress is the correct one to handle the requests, review the app's configuration.

Please note that reviewing your configuration is out of the scope of this support forum, this is not an issue related with the Bitnami deployment and configuration. Please take a look at the Apache's and WordPress' configuration files and make any necessary change to make it work the way you want.

@huzanf
Copy link
Author

huzanf commented Dec 3, 2024

Hi @jotamartos

I have multiple websites on my instance. All websites have their individual vhosts. Is there any issue with that?

@huzanf
Copy link
Author

huzanf commented Dec 3, 2024

Hi @jotamartos
There seems to be some other issue. I have commented both my vhosts file, however, it still redirects to the other domain fdu****.com

If the vhosts are commented, how is the website even loading?

Here's the new support tool code afd191da-f47b-afb2-2f92-0714dd650827

Can you help me with the connectivity issue?
===== 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

[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/

Screenshot
Screenshot 2024-12-04 at 12 05 16 AM

[Apache]

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

[Tue Dec 03 17:02:18.724458 2024] [access_compat:error] [pid 561:tid 696] 
[client **ip_address**:35076] AH01797: client denied by server configuration: 
/opt/bitnami/FDU/

[Tue Dec 03 17:53:31.107840 2024] [access_compat:error] [pid 1059:tid 1151] 
[client **ip_address**:53204] AH01797: client denied by server configuration: 
/opt/bitnami/FDU/.env

[Tue Dec 03 17:53:31.557610 2024] [access_compat:error] [pid 561:tid 743] 
[client **ip_address**:53946] AH01797: client denied by server configuration: 
/opt/bitnami/FDU/

Please check the following guide to troubleshoot server issues:

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

[Resources]

Your instance has little available RAM memory.

Press [Enter] to continue:
               total        used        free      shared  buff/cache   available
Mem:            1941        1234          64         192        1018         707
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 =====

@jotamartos
Copy link
Collaborator

Hi @huzanf,

I can see the entire vhost file for the mer****.org.in domain is commented. That means that Apache knows nothing about that domain. When you perform the request, Apache uses the first virtual host it finds, in this case the one for fdu***.com. Please uncomment and configure the vhost for the mer****.org.in domain.

As I mentoned above, this is a question related to Apache, not to the Bitnami deployment and configuration. If you need further help, please ask in Stack Overflow or find someone in your community who can help you with your configuration.

@huzanf
Copy link
Author

huzanf commented Dec 9, 2024

[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/

Screenshot Screenshot 2024-12-04 at 12 05 16 AM

@jotamartos
Can you help me on the above?

@jotamartos
Copy link
Collaborator

That's probably a false positive. If you can access your site using the IP/domains, that means that connectivity is fine so you shouldn't worry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lamp/mamp/wamp/xampp solved tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

2 participants