ERR_CONNECTION_REFUSED when we use https:// without www - asp.net

Suppose, https://www.domain.com is my website URL
When I have set redirection from
http://domain.com
or
http://www.domain.com
to
https://www.domain.com
it is working perfect
but when i am opening website with https:// and without www then it is giving
ERR_CONNECTION_REFUSED error.
Any response will be highly appriciable.

This error (Error 102) means Azure is not listening on port 443 or there is a firewall which rejects your connection on the host.
So add Listen directive to your configuration:
Listen 443

Related

How do I implement SSL on port

In my Nginx server, I have added SSL to my subdomain using the chatbot.
https://www.example.com/ works but https://www.example.com:8081 doesn't work.
This page gives me "This site can’t provide a secure connection; ERR_SSL_PROTOCOL_ERROR'
Is there any way to configure SSL for this domain with a port?

NGINX server-name and root for a webserver on a local network without any DNS and without configuring etc/hosts on the client

I am completely new to Nginx and php. I have a Baikal self-hosted webserver on my local network and I do not use a DNS. I would like to use it for synchronizing contacts and calendars with my PC and my Android phone.
I have read Nginx tutorial and googled a lot but I still cannot figure out what to use as server-name in nginx and what to use as URL for the client.
I tried :
server_name baikal in Nginx and http://baikal as URL. This works if etc/hosts on the client PC includes baikal. It fails otherwise.
without configuring etc/hosts on the client I tried :
server_name baikal 192.168.1.27/baikal URl
in the client : http://192.168.1.27/baikal produces a 404 error and in the access log Nginx looks for /baikal
What should I use as server name and as url?
On server side
/etc/nginx/sites-available/baikal file must listen on ip address
server {
listen 192.168.1.27:80;
server_name baikal;
root /var/www/baikal;,....
On client side
just type on your browser the ip address 192.168.1.27 and it works

Redirect HTTPS request to HTTP (varnish) and then backend server HTTPS

My current configuration is like this :
1. Nginx listening on Port 8080 and 443
2. Varnish listening to port 80
Currently, when requests are made through HTTP they are delivered through the varnish, but when requests are made through HTTPS varnish doesn't deliver them.
My goal is to put varnish between Client and Nginx web server ( or make varnish work with port 443 )
Reading through articles and answer on StackOverflow, I tried to setup reverse proxy 443 to 80 ( or 8080 maybe ?)
I followed these article(s) :
https://www.smashingmagazine.com/2015/09/https-everywhere-with-nginx-varnish-apache/
https://serverfault.com/questions/835887/redirect-http-to-https-using-varnish-4-1
Problem is that when I try to set these up, I get 502 bad request error, and sometimes the default Nginx page.
PS: I'm trying to set this up using virtual server block, not default server.
PS2: I also need to deliver the final web page through HTTPS weather the request made through HTTP or HTTPS ( but I get too many redirects error )
PS3: I'm using Cloudflare
The basic concept is to sandwich varnish between an entity handling SSL and a back-end server working on port 8080 or whatever you choose.
Here's the traffic flow:
user 443 > front-end proxy for SSL offloading 443 > Varnish 80 > nginx 8080.
Now your options for Front end proxy are:
1.A Load balancer supporting SSL termination / offloading.
2.Nginx or apache working as a proxy to receive traffic on 443 and forward that on port 80 to Varnish.
Error 502 means your Varnish is having issues connecting your backend, please check varnish.vcl

Temporarily redirect https domain to http

How can I configure my NGINX conf file to temporarily redirect an https domain to the http version?
I've found ways to redirect http to https, which is more common, but not the other way around. The reason I need to do this is because I'm in the process of setting up an SSL certificate for a website and somehow, some https URLs are being indexed, on which some assets don't load without the certificate. Thank you in advance!
The problem with redirecting https to http is that you still need a certificate for https - so if you want to redirect because you do not have the certificate yet, this will probably not solve anything, because the secure https connection happens before the redirect.
Otherwise redirecting from https to http works the same as the other way round - it could look something like this: (server block in your http config)
server {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /certificate.pem;
ssl_certificate_key /certificate.key;
return 302 http://$host$request_uri;
}
You just need to adjust the domain name and the certificate paths/filenames.

Apache redirects port with nginx proxy

Whenever I use my nginx proxy which is hosted on the same server as my apache2 server it will redirect straight to the apache2 port instead of staying on the nginx. I've tried setting the host variable to $host:apacheport and it didn't help. Can anyone help me fix this?
(Ex domain.com redirects to domain.com:1234)

Resources