I have SSL enabled via certBot and reversing proxy for my Node-js and everything works fine if my clients request to https://
example.com/
they will see my web site under /var/www/
html/
Document Root Folder.
besides, I want to config Nginx so that if clients request to http://
example.com
see another web site undervar/www/
noSsl/
Document Root Folder.
I actually confuse how to config these two requests in /etc/nginx/sites-enabled/default
file.
thanks.
Asked
Active
Viewed 129 times
0

Mahdi
- 1
- 2
1 Answers
2
Yes, you can configure this.
You need to have two separate server
blocks like:
server {
listen 80;
root /var/www/noSsl;
...
}
server {
listen 443 ssl http2;
root /var/www/html;
...
}

Tero Kilkanen
- 36,796
- 3
- 41
- 63
-
thanks, I try that one before but it actually redirects me on HTTPS everytime and I can not see noSsl contents. There is no config for redirecting though:( – Mahdi Jan 21 '20 at 21:10
-
Then your domain might have some HSTS headers set that force browsers to go to the https version of the site. – Tero Kilkanen Jan 22 '20 at 19:22