By beslergokhan
Hello,
I ve installed Plesk on my Ubuntu 12.04 instance which runs NGinx. I am trying to redirect my subdomain calls to HTTPs. That means any call with http to my subdomain (my.domain.com) should redirect to (https://my.domain.com).
I have followed instructions in the website but they are not working. I could not find the correct file to configure and correct configuration strings.
I am looking for your help to redirect HTTP to HTTPs. What configuration file I should work on and what configuration strings I should add?
Thanks in advance,
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!
Not sure how plesk handle nginx configuration, can be messy to mess around those files too if plesk overwrites them. but you can try this and add some speed/security to your site.
Open an account at cloudflare.com add your domain, and enable strict SSL this will route all your traffic to https even before it reaches your server, is free and add some security and speed to your site.
Now if you find the way via Plesk to avoid files being overwritten, then give it a try, but to be honest is a lot better if you avoid cpanels. One option I can think about it is to create 2 sites, one for http with a redirect (even a header redirect will work), and one for https.
Generally, you’ll want your Nginx configuration to look something like the below to redirect HTTP to HTTPs:
server {
listen 80;
server_name my.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name my.domain.com;
# The rest of your normal configuration
}
The default configuration file is located in /etc/nginx/sites-enabled/default
We might be able to give you more specific instructions if you could give more information like what you already tried or if you can describe exactly what you mean by “not working” (i.e. was there an error message).
Cloudflare will not make your site slower, if any will be faster, specially if you use spdy, which you should as you already have nginx up and running.
Go check cloudflare’s blog, they have good explanations about the SSL and SPDY protocols they offer.
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.