By using this site, you agree to the Privacy Policy.
Accept
EnterinITEnterinITEnterinIT
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Reading: Nginx HTTPS setup with a self-signed SSL certificate
Font ResizerAa
EnterinITEnterinIT
Font ResizerAa
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
  • WINDOWS
  • SCCM Query Collection List
Search
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Linux

Nginx HTTPS setup with a self-signed SSL certificate

Published August 26, 2024
2 Min Read
SHARE

Nginx HTTPS setup with a self-signed SSL certificate.

It’s not recommended to use HTTPS without a valid SSL/TLS certificate. The certificate is used to encrypt communication between the server and client, and without a valid certificate, the connection will not be encrypted and will be vulnerable to attacks.

However, if you still want to use HTTPS without a valid SSL/TLS certificate, you can do so by using a self-signed certificate or a certificate issued by a private Certificate Authority (CA). Here’s how to do it using nginx:

  1. Generate a self-signed certificate:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx-selfsigned.key -out /etc/nginx/ssl/nginx-selfsigned.crt

This command generates a self-signed certificate and key with a validity of 365 days and saves them to /etc/nginx/ssl/nginx-selfsigned.key and /etc/nginx/ssl/nginx-selfsigned.crt respectively.

  1. Configure nginx to use the self-signed certificate:
server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate /etc/nginx/ssl/nginx-selfsigned.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx-selfsigned.key;

    # other server configurations
}

This configuration tells nginx to listen on port 443 (HTTPS) and use the self-signed certificate and key for SSL/TLS encryption.

Note that self-signed certificates are not trusted by default by web browsers and will result in a warning message when a user tries to access the website. To avoid this, you can install the self-signed certificate on the client devices or use a valid SSL/TLS certificate issued by a trusted CA.

TAGGED:AlmaLinuxCentOSLinuxNGINXUbuntu
Previous Article Secure and Seamless: Enabling Single Sign-On for Grafana
Next Article Smoothly Upgrading from Ubuntu 18 to Ubuntu 20
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

Translation

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
by Transposh - translation plugin for wordpress

Popular Posts

System Requirements for Windows Server 2016
Windows Server
Configuration Manager Query Collection List
Configuration Manager Query Collection List
ConfigMgr
Structured/Managed Navigation enabled on Modern Pages in Classic Team Sites
Tech
SCCM Failed to get DP locations as the expected version from MP
ConfigMgr

Recent Posts

Installing and Configuring Fail2ban for SSH Protection on Ubuntu 24.04
Linux
Enabling and Configuring FirewallD on AlmaLinux
Linux
User Creation and SSH Key Setup in AlmaLinux
Linux
How to reset password on AlmaLinux
Linux

© 2023 EnterinIT

Go to mobile version
adbanner
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?