So, I have this server block that supposed to redirect anything from port 80 to https. but somehow it’s not doing that. and when I access my site just using http. the website does not respond at all. I have my firewalls open(NGINX FULL), and i’m at a loss what do to.
server {
listen 80;
server_name opencallcentre.com;
rewrite ^/(.*) https://opencallcentre.com/$1 permanent;
}
server {
listen 443 ssl;
#root /var/www/html;
#index index.html index.htm index.nginx-debian.html;
server_name opencallcentre.com www.opencallcentre.com;
ssl on;
ssl_certificate /home/open-call-centre/opencallcentre.com.chained.crt;
ssl_certificate_key /home/open-call-centre/opencallcentre.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
location / {
# try_files $uri $uri/ =404;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
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!
It seems the server block for port 80 is not configured properly. Can you please try with the following to see if it would work for you
server {
listen 80;
listen [::]:80;
server_name opencallcentre.com www.opencallcentre.com;
return 301 https://www.opencallcentre.com$request_uri;
}
I’ll additionally, recommend checking out the following tutorial about Nginx server blocks, it’s a good read :
Regards, KDSys
I figured it out. in the networking section of the droplet. the firewall didn’t have a rule that allowed HTTP to be accessed. So I just added that rule.
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.