简体   繁体   English

将VPS上的Nginx从http转换为https

[英]Convert nginx on VPS from http to https

I have shared hosting with a2. 我已经与a2共享托管。 I have a domain on there which has an SSL cert. 我那里有一个具有SSL证书的域。

Now I am pointing this domain at a Vultr VPS running Ubuntu + nginx but this doesn't have SSL. 现在,我将此域指向运行Ubuntu + nginx的Vultr VPS,但这没有SSL。

So I basically want: 所以我基本上想要:

https://mya2hostingdomain.com -> https://10.10.10.10 https://mya2hostingdomain.com- > https://10.10.10.10

Currently 目前

http://mya2hostingdomain.com -> http://10.10.10.10 http : //mya2hostingdomain.com- > http://10.10.10.10

works fine. 工作正常。

I'm not sure how to go about this? 我不确定该怎么做? Do I somehow copy the cert from A2 or have to regen a new cert on the linux box? 我是以某种方式从A2复制证书还是必须在Linux机器上重新生成新证书?

Not sure what to do. 不知道该怎么办。

If I understand correctly your issue, a simple reverse proxy configuration should work. 如果我正确理解您的问题,则可以使用简单的反向代理配置。 Here is a sample virtualhost: 这是一个示例虚拟主机:

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;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM