Last active
October 27, 2024 19:00
-
-
Save bugb/e08f4edd1d7ba11706469ccd6cce1dfd to your computer and use it in GitHub Desktop.
Revisions
-
Chau Giang revised this gist
Oct 14, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ Mongo DB works with raw TCP instead of HTTP so we need create `stream` with Nginx. Add the below code above `http` block in nginx config file (eg: `/etc/nginx/nginx.conf` for Ubuntu) ``` -
Chau Giang renamed this gist
Oct 10, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,3 +49,5 @@ http { ``` Here you can share your Mongo DB server to your friend with: `yourip:9999` -
Chau Giang created this gist
Oct 10, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ Add the below code above `http` block in nginx config file (eg: `/etc/nginx/nginx.conf` for Ubuntu) ``` stream { server { listen 9999; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass stream_mongo_backend; } upstream stream_mongo_backend { server localhost:27017; } } ``` The file after modified look like this: ``` user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { .... } stream { server { listen 9999; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass stream_mongo_backend; } upstream stream_mongo_backend { server localhost:27017; } } http { ... } ... ```