×
Installation and guides about a great free, plesk and cpanel alternative project
How to redirect Nginx non-www to www domain over SSL
- infogate
- Συντάκτης θέματος
- Αποσυνδεμένος
- Administrator
- Imagination is the beginning of creation
4 Χρόνια 5 Μήνες πριν #99
από infogate
The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal
How to redirect Nginx non-www to www domain over SSL δημιουργήθηκε από infogate
I am going to assume that you have either a wildcard certificate or two SSL certifcates for the domain named domain.com and www.domain.com
Step 1 – Redirect yourdomain.com to www.yourdomain.com
Edit your nginx.conf or domain level conf file using a text editor such as vim command:
Append the following config:
Step 2 – Redirect all HTTP traffic to HTTPS
Of course all HTTP traffic must be sent to HTTPS server so that Strict-Transport-Security works correctly. Append following in your config file too:
restart now nginx service
How to test redirect non-www to www over SSL with Nginx serer and curl
The syntax is as follows for the curl command:
Step 1 – Redirect yourdomain.com to www.yourdomain.com
Edit your nginx.conf or domain level conf file using a text editor such as vim command:
$ sudo vi /etc/nginx/sites-enabled/yourdomain.com.conf
Append the following config:
### redirect HTTPS n
server {
listen 443 ssl;
server_name theos.in;
ssl_certificate /etc/nginx/ssl/letsencrypt/non-www.theos.in/theos.in.cer;
ssl_certificate_key /etc/nginx/ssl/letsencrypt/non-www.theos.in/theos.in.key;
return 301 https://www.theos.in$request_uri;
}
Step 2 – Redirect all HTTP traffic to HTTPS
Of course all HTTP traffic must be sent to HTTPS server so that Strict-Transport-Security works correctly. Append following in your config file too:
# Redirect www.yourdomain.com:80 to https://www.yourdomain.com:443
server {
listen 80;
access_log off;
error_log off;
server_name www.yourdomain.com;
return 301 https://$server_name$request_uri;
}
# # Redirect http://yourdomain.com:80 to https://yourdomain.com:443
server {
listen 80;
access_log off;
error_log off;
server_name yourdomain.com;
return 301 https://$server_name$request_uri;
}
restart now nginx service
$ sudo systemctl reload nginx
How to test redirect non-www to www over SSL with Nginx serer and curl
The syntax is as follows for the curl command:
curl -IL https://yourdomain.com/
curl -IL http://yourdomain.com/
The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal
Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.
- infogate
- Συντάκτης θέματος
- Αποσυνδεμένος
- Administrator
- Imagination is the beginning of creation
3 Χρόνια 5 Μήνες πριν - 3 Χρόνια 5 Μήνες πριν #159
από infogate
The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal
Απαντήθηκε από infogate στο θέμα How to redirect Nginx non-www to www domain over SSL
Παρακαλούμε συνδεθείτε για να δείτε τις απαντήσεις
The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal
Last edit: 3 Χρόνια 5 Μήνες πριν by infogate.
Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.
Χρόνος δημιουργίας σελίδας: 0.587 δευτερόλεπτα