By psmod2
Hi,
I have a droplet with Dokku and my site is running all ok with my own domain www.mydomain.com.
However its also accessible through the public IP address.
I was just wondering:
1 - Is this a security risk in any way? The site has SSL however that is linked to mydomain.com, if you visit the page with the IP, you’ll see the ‘certificate warning error’ - CERT_COMMON_NAME_INVALID. So if someone uses that, they are risking their data being passed unencrypted.
2 - I’ve disabled it using:
server {
server_name 1xx.xx.xxx.xx;
return 301 https://www.mydomain.com;
}
in the default file located at /etc/nginx/sites-enabled. This works, however is it the correct approach?
Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Access via the IP will always be an option as you have to have a public IP of some sort to allow others to connect.
If you’re only hosting a single domain on the Droplet, or if you have a preferred domain for a redirect, you could always force redirect direct IP access to a domain.
For example:
server {
listen 80;
server_name DROPLET_IP;
return 301 $scheme://yourdomain.com$request_uri;
}
Simply replace DROPLET_IP with the public IP address of your Droplet and yourdomain.com with the domain you’d like to redirect to.
The $scheme and $request_uri portions will handle enforcing HTTP/HTTPS and the requests.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.