简体   繁体   中英

Convert nginx on VPS from http to https

I have shared hosting with a2. I have a domain on there which has an SSL cert.

Now I am pointing this domain at a Vultr VPS running Ubuntu + nginx but this doesn't have SSL.

So I basically want:

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

Currently

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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