Photo by cottonbro: https://www.pexels.com/photo/person-using-macbook-pro-on-white-table-5077049/

Configuring One Server To Handle HTTP & HTTPS Respectively

On an Nginx server, it is possible for you to configure it to manage both HTTP and HTTPS requests.

You should also know that prior to 0.7.14, it was not possible to enable SSL certificate selectively over individual listening sockets, as we have done here in the following given code:

server {
    listen              80;
    listen              443 ssl;
    server_name         www.yoursite.com;
    ssl_certificate     www.yoursite.com.crt;
    ssl_certificate_key www.yoursite.com.key;
    ...
}

Before SSL could only be enabled over the entire server using an SSL directive, thus it was impossible to put up a single HTTP/HTTPS server. Afterward, the SSL parameter of the listen directive was added to resolve this problem.

The use of the SSL directive in newer versions has been discouraged.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.