Author Topic: HTTP to HTTPS Redirection using NGINX + VARNISH + APACHE  (Read 6863 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
HTTP to HTTPS Redirection using NGINX + VARNISH + APACHE
« on: December 05, 2018, 11:25:55 AM »
Can anyone provide a step by step for configuring HTTP to HTTPS redirection for all sites using NGINX + VARNISH + APACHE.

If you go to a domain using HTTPS directly (by typing https://www.domain.com), the web page shows fine. If you go to the same domain using HTTP directly (by typing http://www.domain.com), you get a 404 error. Previously we were only using Apache and the .htaccess file was happily redirecting. Since setting up NGINX and VARNISH, the function has stopped.

Any advice would be much appreciated.

Offline
*
Re: HTTP to HTTPS Redirection using NGINX + VARNISH + APACHE
« Reply #1 on: December 05, 2018, 12:16:49 PM »
if you still run apache as additional webserver or main today new update is released which has support for https, so basically you do the same like before like you are using apache only, rebuild of webservers or via WebServers Conf is required.

probably the best option to handle this (in wordpress for example) to edit url in the wp-admin.



VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: HTTP to HTTPS Redirection using NGINX + VARNISH + APACHE
« Reply #2 on: January 15, 2021, 01:50:52 PM »
Hi, I know this is an old topic. However, I have installed CentOS7 + CWP (Licenced) with a >>Nginx & Varnish & Apache<< setup.
This is my curl output for HTTP & HTTPS
Code: [Select]
HTTP/1.1 200 OK
Server: nginx/1.18.0
Date: Fri, 15 Jan 2021 13:35:14 GMT
Content-Type: text/html
Content-Length: 5069
Connection: keep-alive
Keep-Alive: timeout=60
Vary: Accept-Encoding
Last-Modified: Tue, 24 Jan 2017 21:00:51 GMT
ETag: "13cd-546dd693ee6c0"
Accept-Ranges: bytes
X-Cache: HIT from Backend
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Code: [Select]
HTTP/1.1 200 OK
Server: nginx/1.18.0
Date: Fri, 15 Jan 2021 13:35:19 GMT
Content-Type: text/html
Content-Length: 5069
Connection: keep-alive
Keep-Alive: timeout=60
Vary: Accept-Encoding
Last-Modified: Tue, 24 Jan 2017 21:00:51 GMT
ETag: "13cd-546dd693ee6c0"
Accept-Ranges: bytes
X-Cache: HIT from Backend
Strict-Transport-Security: max-age=31536000
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff

Can someone confirm that this output is OK? How can I test this server-side caching to be 100% sure?
I'm asking this because in both cases I see nginx server. Thought that HTTP is going through Apache and nginx resolves SSL
« Last Edit: January 15, 2021, 01:52:48 PM by Ivansmo »

Offline
**
Re: HTTP to HTTPS Redirection using NGINX + VARNISH + APACHE
« Reply #3 on: March 20, 2021, 07:32:09 AM »
This output is ok as you are using all 3 Webservers so NGINX is showing up as main Webserver.

Your caching headers seems not to use Varnish right now. you need to configure this for your desired domain on "Webservers --> Domain Config" and create a Config for your domain, just make sure you select the profile "nginx->varnish->apache->(php-fpm)" php-fpm only if you activated it.

and in the optional settings check to recreate the vhosts for this domain.

After that varnish should work for your domain, you can check it here: https://isvarnishworking.uk/