You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nginx SSL配置正常但访问提示Server Not Found且日志为空

Troubleshooting "Server Not Found" with Nginx SSL Configuration

Let's break down why you're seeing "Server Not Found" and why your logs are empty—this usually means your request isn't even reaching Nginx in the first place. Here's what to check step by step:

1. First: Verify DNS Resolution

The "Server Not Found" error is a browser-level issue indicating it can't resolve myapp.xyz to an IP address.

  • On your local machine, run:
    ping myapp.xyz
    # Or for more detailed DNS info:
    nslookup myapp.xyz
    
  • Make sure the returned IP matches your server's public IP. If not, you need to fix your domain's DNS records (update the A/AAAA record to point to your server's correct public IP).

2. Check if Nginx is Actually Listening on Port 443

Your netstat output only shows ports 80 and 8069 being listened on, but your config includes a server block for 443. Let's confirm Nginx is monitoring that port:

netstat -tulpn | grep :443

If you don't see nginx in the results, your SSL server block isn't being loaded. Common fixes:

  • Check your main nginx.conf for include directives (like include /etc/nginx/conf.d/*.conf; or include /etc/nginx/sites-enabled/*;) and ensure your site config is in the correct directory to be picked up.
  • Reload Nginx to apply any unloaded config changes:
    nginx -s reload
    

3. Validate Firewall/Security Group Rules

Even if Nginx is listening, incoming traffic on 80/443 might be blocked by a server firewall or cloud security group:

For Linux firewalld:

# Check current allowed services
firewall-cmd --list-all
# Add HTTP/HTTPS if missing
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
# Reload to apply changes
firewall-cmd --reload

For iptables:

# View existing rules
iptables -L -n
# Allow inbound HTTP/HTTPS traffic
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Save rules (distro-specific, e.g., Debian/Ubuntu: `iptables-save > /etc/iptables/rules.v4`)

Cloud Platforms (AWS/Azure/GCP):

Don't forget to check your cloud security group settings—ensure inbound traffic on 80 (HTTP) and 443 (HTTPS) is allowed from your IP (or 0.0.0.0/0 if the app is public-facing).

4. Confirm Nginx Configuration is Fully Loaded

Even though nginx -t passed, double-check your site config is being included:

  • Open /etc/nginx/nginx.conf and verify there's an include line pointing to your config's directory. For example, if your config is in /etc/nginx/sites-available/myapp.conf, make sure you've created a symlink to the sites-enabled directory (common on Debian/Ubuntu):
    ln -s /etc/nginx/sites-available/myapp.conf /etc/nginx/sites-enabled/
    

Then reload Nginx again to ensure changes take effect.

5. Quick Test: Bypass DNS

To rule out DNS issues entirely, edit your local hosts file:

  • On Windows: C:\Windows\System32\drivers\etc\hosts
  • On Linux/macOS: /etc/hosts
    Add a line like:
<your-server-public-IP> myapp.xyz

Then try accessing myapp.xyz again. If it works, you know the problem is definitely with DNS resolution.


内容的提问来源于stack exchange,提问作者ShivaGuntuku

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:23:50