MRatWork Forum by Mustafa Ramadhan
Sawo Project - Kloxo-MR Discussions => Kloxo-MR Tips and Tricks => Topic started by: chrisf on 2013-10-05, 09:32:39
-
I switched to nginxproxy from apache to benefit from the speed on my shared hosting production server.
I have a few domains with SSL enabled and suddenly the sites were in a endless loop and they would not display.
I traced the problem to php checking $_SERVER['HTTPS'] - which behind nginx proxy apache does not know it is https being served.
I was pulling my hair out trying to get this to work - but php was getting environment and server variables from apache which doesn't know nginx is sending ssl pages.
The fix is simple! YET I hope I save someone the trouble I had with this.
ssh:
/home/nginx/conf/globals
if you are using a custom.proxy.conf just add the below lines, if not we must create it:
cp proxy.conf custom.proxy.conf
vim custom.proxy.conf
Find all the lines where it says proxy_set_header and add this line:
proxy_set_header X-Forwarded-Protocol $scheme;
Then go to the directory of the website having the endless ssl loop due to a php redirect.
Example:
if ($_SERVER['HTTPS'] !== on) {
// redirect to https here ----
Add this to the .htaccess of the domain with ssl:
SetEnvIf X-Forwarded-Protocol https HTTPS=on
sh /script/fixweb
sh /script/restart-all
All fixed :)
This is for those who understand php programming and ssl redirect being forced through php headers.
Everyone else :) this doesn't apply....
Enjoy
-
Why the heck didn't i find this post that would have saved me 1 night sleep and almost 24h of research and troubleshooting?
I'm convinced your findings here will help MANY users of Kloxo-MR.
EDIT: can you update the typo as it should be: SetEnvIf X-Forwarded-Proto https HTTPS=on
and you if you are using Hiawatha proxy, you don't need fixweb/restart-all as it's already sending X-Forwarded-Proto to the backend.
-
Not a typo :) as in nginx configuration I had added the full 'protocol' - however if Hiawatha is sending proto to the backend, simply change that (as you have).
-
chrisf, thank you for this saving time tip!
-
@chrisf
can you explain me bit more i have same issues but i didnt get your fix can yu more specific guide me
-
That was step by step. If you need more help (send me a PM) and we'll see what we can do :)
-
can't fiend " /home/nginx/conf/globals " !!
-
can't fiend " /home/nginx/conf/globals " !!
If using Kloxo-MR 7.0, go to '/opt/configs/nginx/conf/globals' instead '/home/nginx/conf/globals'
-
and sorry i didn't fiend 'proxy.conf'
but i fiend more than file,
- proxy_standard.conf
- proxy_standard_ssl.conf
- proxy_wildcards.conf
- proxy_wildcards_ssl.conf
which file i copy and edit it ?
-
All.
-
mengapa nginx 502 badgateway add domain di client ?
-
mengapa nginx 502 badgateway add domain di client ?
Bisa lebih diperjelas?.
-
Jdi pd saat membuat website baru pada client setelah pilih adddomain kemudian menghapus file image dan index.html kemudian download wordpress setelah itu ekstrak. ketika dibuka dibrowser muncul erorr 502 badgateway jika menggunakan nginx. lain jika menggunakan hiawatha,apache,httpd berhasil masuk ke setup wordpress pd saat buka browser dan msuk ke domain tersebt.
-
Sementara pakai apache atau hiawatha-proxy saja.
Saya menemukan 'banyak' keanehan pada nginx untuk versi akhir-akhir ini.
-
baik, Mas Mustafa Ramadhan trimakasih saranya... :) :D