将 VPS 上的 nginx 从 http 转换为 https
Convert nginx on VPS from http to https
我已与 a2 共享主机。我在那里有一个域,它有一个 SSL 证书。
现在我将此域指向 Vultr VPS 运行 Ubuntu + nginx,但这没有 SSL。
所以我基本上想要:
https://mya2hostingdomain.com -> https://10.10.10.10
目前
http://mya2hostingdomain.com -> http://10.10.10.10
工作正常。
我不知道该怎么做?我是以某种方式从 A2 复制证书还是必须在 linux 框中重新生成新证书?
不知道该怎么做。
如果我对你的问题的理解正确,一个简单的反向代理配置应该可以工作。这是一个示例虚拟主机:
server {
server_name mya2hostingdomain.com;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/mya2hostingdomain.com.crt;
ssl_certificate_key /etc/ssl/private/mya2hostingdomain.com.key;
location / {
include /etc/nginx/proxy_params;
proxy_pass http://10.10.10.10;
}
}
我已与 a2 共享主机。我在那里有一个域,它有一个 SSL 证书。
现在我将此域指向 Vultr VPS 运行 Ubuntu + nginx,但这没有 SSL。
所以我基本上想要:
https://mya2hostingdomain.com -> https://10.10.10.10
目前
http://mya2hostingdomain.com -> http://10.10.10.10
工作正常。
我不知道该怎么做?我是以某种方式从 A2 复制证书还是必须在 linux 框中重新生成新证书?
不知道该怎么做。
如果我对你的问题的理解正确,一个简单的反向代理配置应该可以工作。这是一个示例虚拟主机:
server {
server_name mya2hostingdomain.com;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/mya2hostingdomain.com.crt;
ssl_certificate_key /etc/ssl/private/mya2hostingdomain.com.key;
location / {
include /etc/nginx/proxy_params;
proxy_pass http://10.10.10.10;
}
}