Couchdb 使用 SSL 和 Nginx 来恢复 IP

问题描述 投票:0回答:1

我有一个包含 CouchDB 的 docker 容器,我想将它与我在 Cloudflare 中的域链接起来,以通过 SSL 保证连接安全,所以我可以使用 Nginx 将 Droplet 的 ip 与 CouchDB 容器的域反转,或者是最好为 SSL 配置 CouchDB。

docker nginx couchdb cloudflare
1个回答
0
投票

1-创建液滴。 2-docker-compose.yml 用于 CouchDB。

version: '3'
services:
couchserver:
image: bitnami/couchdb
restart: always
ports:
- "5984:5984"
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=pass
volumes:
- ./dbdata:/opt/couchdb/data

-docker-撰写

3-将域名与 Cloudflare 链接并创建 SSL。 4-将液滴与域连接。 5-使用Nginx将droplet的IP与域反向。 6-安装 NGINX(不是 Droplet 本身上的容器)并配置。 sudo apt安装nginx 8-并更改 nginx 配置文件。 7-sudo nano /etc/nginx/sites-available/default

# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name yourdomain.com www.domain.com;
location / {
proxy_pass http://68.183.5.130:5984; #whatever port your app runs on
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
#pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;

最后你的连接将是:(

https://username:[email protected]/yourDB
)

© www.soinside.com 2019 - 2024. All rights reserved.