Back

[SOLVED] Not able to setup https connection with Appwrite running behind Nginx

  • 0
  • Self Hosted
  • Tools
  • General
ZiaChoudhary
19 Aug, 2023, 12:18

hey Hope you all are doing well. Appwrite is now has become my favorite backend . I was tired of high pricings of Firebase so I decided to self host Appwrite on my own server. It was a good experience that everything is well documented and I was able to self host Appwrite very easily. During the process the only problem that I faced was SSl and serving Appwrite behind my Nginx Proxy Server. Please clear my doubts regarding: 1. I want to run my Appwrite on a different ports say 5696 for http and 5697 for SSL. It works fine when with http but not worked with https. and here is my Nginx Config file

TypeScript
 listen 80;
 server_name example.com www.example.com;

 location / {
     proxy_pass http://example.com:5696;
     proxy_http_version 1.1;
     proxy_set_header   Host               $host:$server_port;
     proxy_set_header   X-Real-IP          $remote_addr;
     proxy_set_header   X-Forwarded-For    $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Proto  $scheme;

 }
}```                                                                                                                                                                                                                                                                             What should I do to make it able to serve on https and http as well. All of your kind and valuable suggestions are welcome.
TL;DR
The user is asking for help setting up an HTTPS connection with Appwrite running behind Nginx. They have tried changing ports and using SSL certificates, but have not been successful. They are looking for suggestions on how to serve Appwrite on both HTTP and HTTPS. There is no solution provided in the thread.
Drake
19 Aug, 2023, 15:10

Maybe you need another one of these but for port 443 and 5697?

ZiaChoudhary
19 Aug, 2023, 16:06

@Steven thank for your valuable time I did Try alot but not finding a way to get a legit work around.

Drake
19 Aug, 2023, 16:07

Also I'm not sure if you need the server port in that host header

Drake
19 Aug, 2023, 16:07

What did you put for the other nginx config? What's the problem?

ZiaChoudhary
19 Aug, 2023, 16:11

Currently i am having only this config file. filehttps://discord.com/channels/564160730845151244/1142432370104991834/1142432370104991834

And with this i am not able to open up my Apwrite console with https.but when with the same file i set the default ports of appwrite as 80 as 443 then everything works fine. And when i change my ports to anyother value then they work only for http not for https part.

Drake
19 Aug, 2023, 16:12

Well this is port 80 so of course port 443 won't work 🧐

ZiaChoudhary
19 Aug, 2023, 16:13

Sorry i did not get your point may you elaborate it.

Drake
19 Aug, 2023, 16:14

You have listen 80 here. That means nginx is listening for http traffic and then will forward to Appwrite. I'm not that great with nginx, but I'm pretty sure you need another config similar to this but with listen 443

ZiaChoudhary
19 Aug, 2023, 16:17

Yep i have tried that one too, i tried using certboot with let's encrypt generated ssl certificate as well while listening 443 with nginx but that also failed too. At the moment I am trying some more fixes and will let you know more about it with in next hours.

ZiaChoudhary
19 Aug, 2023, 16:41

@Steven I am curious to know about the fact that when we change default port 80 to amyother value, our apwrite console run smoothly on http. But when we change ssl port 443 to amy other it shows 404 page not found. Can't we make some default changes in traefik so that it can handle ssl/https on any other port as well just like it handles http request even when default postt 80 has changed to some other value? Is there a way?

Drake
19 Aug, 2023, 16:48

I'm not really sure what you mean. You can have Appwrite exposed on any port you want. What exactly did you change to change Appwrite's ports?

ZiaChoudhary
19 Aug, 2023, 16:55

@Steven i just have solved this and now its working amazingly behind nginx proxy

ZiaChoudhary
19 Aug, 2023, 16:55

I will share the solution what i did.

ZiaChoudhary
19 Aug, 2023, 16:55

Attavhing complete solution with in a few minutes

hamed
19 Aug, 2023, 18:08

@ZiaChoudhary looking forward:)

ZiaChoudhary
19 Aug, 2023, 18:12

Solution Please read the guide and follow all the steps carefully. If you find any issues do contact

https://medium.com/@zia-ch/how-to-run-appwrite-with-nginx-professionally-5ba420789ef0

D5
19 Aug, 2023, 20:00

[SOLVED] Not able to setup https connection with Appwrite running behind Nginx

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more