How do I redirect all traffic to the https:// domain?
How do I redirect all traffic to the https:// domain?
Hey guys,
I've setup Vesta and added SSL support for all domains with Let's Encrypt. When manually typing https://domain.com it'll show the site with SSL turned on, but when I just type domain.com it'll always navigate to the non-SSL http:// variant.
How do I make all traffic, per domain or all domains all together (since all domains will have SSL) go automatically to https://domain.com ?
I already googled and saw lots of suggestions, including server {} blocks, which I pasted within the http {} part in the /etc/nginx/nginx.conf file and restarted the server, but that didn't change a thing..
I've setup Vesta and added SSL support for all domains with Let's Encrypt. When manually typing https://domain.com it'll show the site with SSL turned on, but when I just type domain.com it'll always navigate to the non-SSL http:// variant.
How do I make all traffic, per domain or all domains all together (since all domains will have SSL) go automatically to https://domain.com ?
I already googled and saw lots of suggestions, including server {} blocks, which I pasted within the http {} part in the /etc/nginx/nginx.conf file and restarted the server, but that didn't change a thing..
Re: How do I redirect all traffic to the https:// domain?
Post is older but doc is actual.
After step 2, there're in /usr/local/vesta/data/templates/web/nginx/ two new files, force-https.stpl and force-https.tpl
Step 3 create a package or force-https no work using any template named force-https
Any template named force-htpps on VestaCP interface, in new template or on domain for apply new template.
What is wrong?
I'm using vestaCp 0.9.8 Release 26
Well...How to force https/SSL on a domain
1. Install custom nginx template3. Create new package or set force-https as nginx template in the existing packageCode: Select all
cd /usr/local/vesta/data/templates/web wget http://c.vestacp.com/0.9.8/rhel/force-https/nginx.tar.gz tar -xzvf nginx.tar.gz rm -f nginx.tar.gz
4. Add new user and assing him package with force-https template
5. Add new domain with SSL certificate and check the result
After step 2, there're in /usr/local/vesta/data/templates/web/nginx/ two new files, force-https.stpl and force-https.tpl
Step 3 create a package or force-https no work using any template named force-https
Any template named force-htpps on VestaCP interface, in new template or on domain for apply new template.
What is wrong?
I'm using vestaCp 0.9.8 Release 26
-
- Posts: 12
- Joined: Sat Jul 15, 2023 9:33 am
- Contact:
- Os: CentOS 7x
- Web: apache + nginx
Re: How do I redirect all traffic to the https:// domain?
Hi,
You can configure the server block to redirect all traffic to the HTTPS version of your domains.
Here's how:
1. Go to Nginx configuration '/etc/nginx/conf.d/'.
2. Create a new configuration file for redirection.
3. Edit https-redirect.conf and paste the below code.
4, Save it then test the Nginx configuration.
5. If everything is correct, you should see a message
Finlay restart to apply changes.
Manually check individual urls or use any online tool such as this https://redirectchecker.com/ to get a detailed redirection chain and its status code.
I hope the above steps help.
You can configure the server block to redirect all traffic to the HTTPS version of your domains.
Here's how:
1. Go to Nginx configuration '/etc/nginx/conf.d/'.
2. Create a new configuration file for redirection.
3. Edit https-redirect.conf and paste the below code.
Code: Select all
server {
listen 80;
server_name domain.com www.domain.com;
location / {
return 301 https://domain.com$request_uri;
}
}
Code: Select all
nginx -t
Finlay restart to apply changes.
Code: Select all
systemctl reload nginx
I hope the above steps help.
Re: How do I redirect all traffic to the https:// domain?
Wow, This guide is very useful to me.shanjie wrote: ↑Fri Jun 23, 2017 12:44 amhttps://vestacp.com/docs/#how-to-force-https geometry dash world