Service eligibility and regional restrictions
PuppyIP serves only compliant overseas businesses and their authorized personnel. Proxy services are not available in mainland China. The service may only be used for lawful business activities outside mainland China. Use of this service within mainland China is prohibited.
Hosting a proxy IP or server overseas does not change these restrictions. The service must not be provided to end users in mainland China through relaying, forwarding, sharing or resale. Before use, read the Terms of Service.
Key Takeaways
- TLS SNI helps Nginx choose a virtual host. If the name does not match, it may serve the default server's certificate.
- Check listen 443, server_name, the certificate chain and proxy route rather than only confirming that a certificate file exists.
- Fixing HTTPS does not automatically fix OAuth; the application callback, public base URL and registered OAuth URL must match.
- Verify with the target hostname and SNI on the actual HTTPS endpoint, then perform a real callback test.
A certificate mismatch usually starts with the selected Nginx virtual host
When Nginx serves multiple TLS sites on one IP and port, it uses the handshake's SNI and configured server_name to select a virtual host. If the requested hostname does not match the intended block, the connection may fall through to default_server or a default site chosen by configuration order and return a different domain's certificate. A certificate file existing on disk does not mean requests for that hostname use it.
Classify the error as DNS/connectivity, TLS hostname or chain, HTTP proxy routing, or application-level callback failure. A Nezha page may be inaccessible while TLS is wrong; after the certificate path is corrected, OAuth can still fail because its callback URL differs. These layers need separate checks.
Read-only checks for Nginx listeners, server_name and the served certificate
First confirm the addresses and ports Nginx listens on, then match the resolved domain to its TLS server block. Read nginx -T locally; do not copy the full configuration. Use the target hostname as SNI and require the TLS client to verify both the trusted certificate chain and hostname. Inspect the SAN, issuer and validity dates as additional certificate details. Subject, issuer or dates alone do not mean verification passed.
If the service is behind a CDN, load balancer or multiple Nginx backends, verify the user-facing and origin-management paths separately. Connecting to 127.0.0.1 checks only the local listener; it does not prove that the public load balancer has updated. Use an endpoint you are authorized to inspect and ensure the client has a trusted system CA store. For an internal CA, provide its trusted chain through the system's trust configuration before hostname verification. Do not disable certificate verification.
Check Nginx syntax and TLS server settings
shnginx -t
nginx -T 2>/dev/null | grep -E 'listen .*443|server_name|ssl_certificate'
Inspect the served certificate with the target SNI
shset -eu
TARGET_HOST='REPLACE_WITH_TARGET_TLS_HOSTNAME'
CONNECT_TO='REPLACE_WITH_AUTHORIZED_CONNECT_HOST:443'
OPENSSL_VERSION=$(openssl version) || exit 1
case "$OPENSSL_VERSION" in
"OpenSSL 1.1.1"*|"OpenSSL 3."*) ;;
*) printf 'OpenSSL version must support hostname verification: %s\n' "$OPENSSL_VERSION" >&2; exit 2;;
esac
openssl s_client -help 2>&1 | grep -q -- '-verify_hostname' || { printf 's_client lacks -verify_hostname\n' >&2; exit 2; }
WORK_DIR=$(mktemp -d) || exit 1
trap 'rm -rf "$WORK_DIR"' EXIT
trap 'exit 129' HUP
trap 'exit 130' INT
trap 'exit 143' TERM
if openssl s_client -connect "$CONNECT_TO" -servername "$TARGET_HOST" -verify 10 -verify_return_error -verify_hostname "$TARGET_HOST" -showcerts </dev/null >"$WORK_DIR/handshake.txt" 2>&1; then
:
else
TLS_STATUS=$?
grep -E 'verify error|Verification error|Verify return code' "$WORK_DIR/handshake.txt" || true
exit "$TLS_STATUS"
fi
awk '/-----BEGIN CERTIFICATE-----/ { if (!seen++) printing=1 } printing { print } /-----END CERTIFICATE-----/ && printing { exit }' "$WORK_DIR/handshake.txt" >"$WORK_DIR/leaf.pem"
test -s "$WORK_DIR/leaf.pem" || { printf 'No leaf certificate received\n' >&2; exit 1; }
openssl x509 -in "$WORK_DIR/leaf.pem" -noout -subject -issuer -dates -ext subjectAltName
grep -F 'Verify return code: 0 (ok)' "$WORK_DIR/handshake.txt"
After confirming the match, correct the virtual host and certificate association
Only after confirming that the TLS request enters the wrong server block, update server_name, listen and the certificate path in the matching Nginx site configuration. Back up the edited site file first and confirm the roles of existing HTTPS sites and the default site. Do not rewrite the whole nginx.conf or delete the default block as a guess. Check the full certificate chain, key permissions and renewal deployment path as well.
Run nginx -t before applying the change, then reload Nginx during a maintenance window; do not reload if the syntax check fails. Keep the config backup and original service route for rollback. After correcting certificate selection, verify the target hostname and HTTP page before investigating OAuth. Avoid changing the application base URL and Nginx routing in the same round.
Once TLS works, check the GitHub OAuth callback separately
An OAuth callback failure is a different layer from the default certificate. Compare Nezha's public base URL, the callback registered with the OAuth provider and the actual scheme/host/path character by character, including HTTPS, hostname, subpath and trailing slash. The reverse proxy must also pass the Host and HTTPS proxy headers the application expects. Do not switch to HTTP or an unregistered hostname to bypass callback validation.
Nezha releases can differ in OAuth configuration fields; follow documentation for the running version. Before changing provider registration or server settings, back them up and confirm that an administrator can still log in. If TLS works but login is rejected, record the redacted callback path and status code. Never put an OAuth client secret, application key or user token in a log or ticket.
Verify TLS, page proxying and OAuth login separately
Run three independent checks for the target domain: the TLS client successfully verifies the certificate chain and hostname, the reported SAN covers the target name and the validity dates are appropriate; the HTTPS page reaches Nezha through Nginx; and OAuth returns to the exact callback. A browser lock only describes one access path's TLS check; it does not prove the proxy upstream, application URL or OAuth authorization is correct.
If the Nezha version page, static assets and health check work but OAuth fails, continue with OAuth settings rather than rotating the TLS certificate. If the local request works but the public request still gets an old certificate, inspect CDN/load-balancer backends, DNS and cache propagation. Do not generalize a local openssl result to every access path.
Rollback and security boundaries
If Nginx configuration validation fails, another site's certificate breaks or the proxy upstream becomes unreachable, restore the latest site configuration backup, run nginx -t and only then reload. Keep certificate files, private keys and OAuth secrets in restricted-permission locations; never include them in a config diff, screenshot or knowledge-base article.
This procedure is scoped to Nezha v2.2.10. On other releases, check OAuth fields against documentation for the running version rather than assuming identical settings. A correct certificate still needs a real OAuth callback to pass. Close the full chain only after TLS, the application page and authorization login have each been verified.
Sources
Frequently Asked Questions
Why does Nginx return a certificate for a different domain?
The requested SNI may not match the intended server_name, so Nginx selects a default TLS server. Check the actual listener, virtual-host match and served certificate.
If OAuth still fails after fixing the certificate, does that mean TLS was not updated?
Not necessarily. TLS and OAuth callback matching are separate layers. Compare the application base URL, registered callback and proxy headers.
Can I share the full output from nginx -T for troubleshooting?
Do not publish the complete output. It can include internal names, upstream addresses, file paths or authentication settings. Share only redacted server_name, listen and error lines.
Does a correct certificate from local openssl prove the public site is correct?
No. A CDN, load balancer, DNS or cache may still point to another backend. Verify through the actual user-facing path with the target SNI.