How to disable SSL checking on Nginx?

Abstract: Resolve 502 Bad Gateway errors caused by invalid or self-signed SSL certificates when Nginx proxies HTTPS traffic.

Created: 2026-09-04 by
To disable SSL checking on Nginx, you must configure the upstream server block to ignore certificate validation errors. This is achieved by setting the proxy_ssl_verify directive to off within your server configuration file. This method is primarily intended for debugging environments or internal networks where self-signed certificates are in use, rather than production systems facing the public internet.

Understanding SSL Verification in Nginx

When Nginx acts as a reverse proxy, it communicates with backend servers over HTTPS. By default, Nginx verifies the SSL certificate presented by the upstream server to ensure it is valid, trusted, and matches the domain name. If the certificate is self-signed, expired, or misconfigured, Nginx will reject the connection, resulting in errors such as 502 Bad Gateway or 504 Gateway Timeout. Disabling this verification allows Nginx to proceed with the connection regardless of certificate validity, which is useful during development or when managing internal services that do not require strict external trust chains.

Configuring Proxy SSL Verification

The core mechanism for controlling SSL verification lies in the proxy_ssl_verify directive. You need to locate the specific server block in your Nginx configuration file that handles the proxying to the problematic upstream service. Inside this block, or in the http context if applying globally, add the following line:
proxy_ssl_verify off;
This single directive tells Nginx to skip all checks against the certificate authority chain and hostname matching. It effectively bypasses the security handshake validation. After adding this line, you must reload the Nginx configuration to apply the changes without dropping existing connections. Use the command sudo nginx -s reload to restart the service gracefully. Verify that the configuration syntax is correct before reloading by running sudo nginx -t.

Additional SSL Context Settings

While proxy_ssl_verify off disables the verification check, other SSL-related directives may also need adjustment depending on your specific error scenario. For instance, if you encounter issues related to certificate paths or protocol versions, you might need to review proxy_ssl_protocols and proxy_ssl_ciphers. In some cases, particularly when dealing with older backends, you may need to allow less secure protocols like TLSv1.0 or TLSv1.1, though this is generally discouraged for security reasons. If you are troubleshooting key reading issues similar to those described in our guide on Troubleshooting Nginx Server, ensure that the certificate files are readable by the Nginx worker processes. Sometimes, disabling verification alone is not enough if the underlying file permissions or path configurations are incorrect. Always check the Nginx error logs located at /var/log/nginx/error.log to identify the root cause of the failure.

Safety and Security Considerations

Disabling SSL verification significantly reduces the security posture of your Nginx proxy. It makes the connection vulnerable to man-in-the-middle attacks, where an attacker could intercept and modify traffic between Nginx and the upstream server without detection. Therefore, this setting should never be used for public-facing services or sensitive data transmission. It is strictly recommended for isolated internal networks, local development environments, or temporary troubleshooting sessions. Once the issue is resolved, you should re-enable verification and fix the underlying certificate problem instead of leaving the system insecure. For users managing containerized environments, such as Docker setups, ensuring proper network isolation is crucial. As discussed in How to Configure Nginx to Serve a Docker Container on Localhost, local containers often use self-signed certificates for convenience. In these cases, disabling verification is a common workaround, but securing the container network itself is a better long-term solution.

Verifying the Configuration

After applying the changes, test the connectivity to the upstream server. You can use tools like curl or a web browser to access the proxied service. Check the response headers and status codes to confirm that the request is being processed correctly. If you still encounter errors, review the Nginx error log for additional clues. Common issues include mismatched server names or incorrect port configurations, which are distinct from SSL verification problems. In complex proxy setups, such as those involving multiple server contexts, ensure that the proxy_ssl_verify directive is placed in the correct scope. If it is set in the http block, it applies globally unless overridden in a more specific server or location block. This hierarchical structure allows for granular control over SSL behavior across different virtual hosts.

Alternative Approaches

Instead of completely disabling verification, you can import the self-signed certificate into Nginx's trusted CA bundle. This involves copying the upstream server's certificate into the directory specified by proxy_ssl_trusted_certificate. This approach maintains security while allowing connections to internal servers with non-standard certificates. It requires more initial setup but provides a robust and secure solution for production-like environments. Another alternative is to use SSL passthrough, where Nginx does not terminate the SSL connection but forwards it directly to the backend. This shifts the responsibility of certificate validation to the final destination server. While this avoids Nginx-level verification issues, it requires careful network configuration and may impact performance due to increased latency.

Frequently Asked Questions

Does disabling SSL verification affect HTTP traffic?

No, the proxy_ssl_verify directive only applies to HTTPS upstream connections. HTTP traffic remains unaffected and continues to operate normally without any SSL-related checks or modifications.

Can I disable SSL verification for specific locations only?

Yes, you can place the proxy_ssl_verify off; directive inside a specific location block. This allows you to bypass verification for certain endpoints while keeping it enabled for others in the same server block.

What happens if I forget to reload Nginx after making changes?

The new configuration will not take effect until Nginx is reloaded or restarted. The server will continue to use the old settings, meaning SSL verification errors will persist until the configuration is applied.

Is it safe to use this setting in a production environment?

It is generally unsafe for production environments handling sensitive data. It exposes your application to man-in-the-middle attacks and should only be used in trusted, isolated networks or for temporary debugging purposes.

How do I check if SSL verification is currently disabled?

You can inspect your Nginx configuration files using grep -r "proxy_ssl_verify" /etc/nginx/. If the output shows proxy_ssl_verify off;, then verification is disabled for that scope.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More