# Nginx + apache + ssl = 421 misdirected request

**URL:** <https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502>\
**Category:** Web\
**Created:** [July 12, 2025, 12:24pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502 "2025-07-12T12:24:48Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![maurice](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.hestiacp.com/u/maurice)\
**Post date:** [July 13, 2025, 10:58am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/21 "2025-07-13T10:58:03Z")

</div>

@servtelecom  
As described above, to also fix phpmyadmin & webmail:  
`echo -e "proxy_ssl_server_name on;\nproxy_ssl_name \$host;" > /etc/nginx/conf.d/fixssl.conf && service nginx restart`

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [July 13, 2025, 11:04am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/22 "2025-07-13T11:04:03Z")

</div>

I checked it myself - I can’t confirm. The script works correctly. Webmail opens without problems.

---

<div class="post-metadata">

**Author:** ![nu01](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/nu01/32/7639_2.png) [@nu01](https://forum.hestiacp.com/u/nu01)\
**Post date:** [July 13, 2025, 11:40am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/23 "2025-07-13T11:40:46Z")

</div>

exactly, just like @anon85655380 stated, webmail works too. Roundcube is mine.  
Are you running the command as root/admin? try rebooting once.

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [July 13, 2025, 11:53am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/24 "2025-07-13T11:53:14Z")

</div>

The script must be run under root. Everything works. I don’t see a problem at the moment.

---

<div class="post-metadata">

**Author:** ![nu01](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/nu01/32/7639_2.png) [@nu01](https://forum.hestiacp.com/u/nu01)\
**Post date:** [July 13, 2025, 12:09pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/25 "2025-07-13T12:09:36Z")

</div>

Yes. Hence I asked the question. I ran it as root only. Worked fine, but as @servtelecom says, it does not seem to be working for mail.

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [July 13, 2025, 12:20pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/26 "2025-07-13T12:20:51Z")

</div>

Try running - v-rebuild-mail-domains yourusername

This should solve the problem.

---

<div class="post-metadata">

**Author:** ![nu01](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/nu01/32/7639_2.png) [@nu01](https://forum.hestiacp.com/u/nu01)\
**Post date:** [July 13, 2025, 12:25pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/27 "2025-07-13T12:25:49Z")

</div>

I think you are confused. It runs fine for me, and I was suggesting and asking the user above. Everything works perfectly fine for me.  
But @servtelecom (Alex), try what @anon85655380 (Yevhen) states. It should help solve your issue. 🙂

---

<div class="post-metadata">

**Author:** ![anon85655380](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/a/e56c9b/32.png) [@anon85655380](https://forum.hestiacp.com/u/anon85655380)\
**Post date:** [July 13, 2025, 12:30pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/28 "2025-07-13T12:30:24Z")

</div>

I don’t have any problems either.

---

<div class="post-metadata">

**Author:** ![mavbcn](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@mavbcn](https://forum.hestiacp.com/u/mavbcn)\
**Post date:** [July 13, 2025, 4:32pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/29 "2025-07-13T16:32:48Z")

</div>

> [@maurice](#):
>
> proxy\_set\_header SNI $host;  
> proxy\_ssl\_verify off;  
> proxy\_ssl\_server\_name on;

Hi,  
I’m having the same problem, I only get the sucess page of the server, not the website  
could you help me, pleae?  
thanks  
bes

---

<div class="post-metadata">

**Author:** ![nu01](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/nu01/32/7639_2.png) [@nu01](https://forum.hestiacp.com/u/nu01)\
**Post date:** [July 13, 2025, 4:54pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/30 "2025-07-13T16:54:02Z")

</div>

> [@sahsanu](#):
>
> use this script to fix the templates and rebuild the domains at once.
> 
> ```auto
> curl -fsSLm15 https://7j.gg/fixnginx421 | sudo bash -s --
> 
> ```

@mavbcn follow this. Run as root.

---

<div class="post-metadata">

**Author:** ![mavbcn](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@mavbcn](https://forum.hestiacp.com/u/mavbcn)\
**Post date:** [July 13, 2025, 5:24pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/31 "2025-07-13T17:24:06Z")

</div>

Hi,  
Only to use the script? or I have to do some other changes?  
thanks for your help

---

<div class="post-metadata">

**Author:** ![mavbcn](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@mavbcn](https://forum.hestiacp.com/u/mavbcn)\
**Post date:** [July 13, 2025, 6:18pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/32 "2025-07-13T18:18:38Z")

</div>

the laravel site works fine, but I have a site in cloudflare with full strict, and I have a Invalid SSL certificate Error code 526  
thanks for your help

---

<div class="post-metadata">

**Author:** ![AlanOsta](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/alanosta/32/3771_2.png) [@AlanOsta](https://forum.hestiacp.com/u/AlanOsta)\
**Post date:** [July 13, 2025, 7:46pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/33 "2025-07-13T19:46:42Z")

</div>

Just want to thank @maurice and @sahsanu for your wonderful help.  
❤

---

<div class="post-metadata">

**Author:** ![moodoohoo](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@moodoohoo](https://forum.hestiacp.com/u/moodoohoo)\
**Post date:** [July 13, 2025, 8:17pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/34 "2025-07-13T20:17:25Z")

</div>

A huge shout out to @maurice and @sahsanu. I did the updates and was scratching my head there for a while.

---

<div class="post-metadata">

**Author:** ![clemenza1](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/clemenza1/32/8801_2.png) [@clemenza1](https://forum.hestiacp.com/u/clemenza1)\
**Post date:** [July 13, 2025, 9:55pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/35 "2025-07-13T21:55:24Z")

</div>

Thanks for the solution, I thought I had unintentionally broken something… (I’m no linux expert, and I’m always testing, changing things…).

Now I see it’s a general problem. I’ve already fixed it thanks to the help you offer here (thank you very much).

Would it be possible to implement this automatic repair in HestiaCP? I have more VPS with hestiacp and I’m worried about them updating and breaking… I don’t know if it’s better to update them and break them myself, and then repair them, or wait for Hestia to implement this solution automatically.

Thanks

---

<div class="post-metadata">

**Author:** ![luisedofon](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/l/839c29/32.png) [@luisedofon](https://forum.hestiacp.com/u/luisedofon)\
**Post date:** [July 14, 2025, 1:21am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/36 "2025-07-14T01:21:05Z")

</div>

Well, @sahsanu and another guy I saw earlier on another topic about same issue, already sent a request on github in order to fix the issue… By myself, what I can tell to anyone interested, is that I have made a fresh Debian 12 install on a VM and have installed HestiaCP 1.9.3 on it and issue is presented since this installation, fixed again with @sahsanu scripts provided earlier here…

Now, if you are not sure about update or not other VPS my suggestion will be to first download a backup copy of all users of the Server and if you have Snapshots available on the VPS you could take 1 before update and if after update, fix scripts and server reboot (or just restart Apache and Nginx services, something I did) is not working certainly you can revert changes with snapshot, in the worst scenario, you will have backups, so server reinstall and restore still possible… (U will need to run fix anyway hehe).

---

<div class="post-metadata">

**Author:** ![servtelecom](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@servtelecom](https://forum.hestiacp.com/u/servtelecom)\
**Post date:** [July 14, 2025, 6:35am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/37 "2025-07-14T06:35:56Z")

</div>

I just tried it and it worked for me! Thank you so much! Excellent work!

---

<div class="post-metadata">

**Author:** ![chrmina](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chrmina/32/8803_2.png) [@chrmina](https://forum.hestiacp.com/u/chrmina)\
**Post date:** [July 14, 2025, 10:11am UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/38 "2025-07-14T10:11:27Z")

</div>

Thank you! That solved the problem!

---

<div class="post-metadata">

**Author:** ![mavbcn](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@mavbcn](https://forum.hestiacp.com/u/mavbcn)\
**Post date:** [July 14, 2025, 1:38pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/39 "2025-07-14T13:38:54Z")

</div>

It worked very well  
thanks so much for your help!

---

<div class="post-metadata">

**Author:** ![geomagas](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/geomagas/32/7315_2.png) [@geomagas](https://forum.hestiacp.com/u/geomagas)\
**Post date:** [July 14, 2025, 6:56pm UTC](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502/40 "2025-07-14T18:56:03Z")

</div>

@maurice & @sahsanu you saved my life. My clients were ready to eat me alive! 😛

[Previous page](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502.md?page=1)

[Next page](https://forum.hestiacp.com/t/nginx-apache-ssl-421-misdirected-request/19502.md?page=3)
