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

无法访问公司服务器上非80端口运行的Nginx server_block

Troubleshooting Steps for Nginx 8082 Port Timeout on Ubuntu 16.04

Let’s work through this step by step—since you’ve already checked the basics like UFW rules and Nginx listening status, the issue is likely either a network-level restriction or a subtle server-side configuration/permission problem.

1. Test Local Access First (Isolate Network vs. Server Issues)

Start by verifying if the service works directly on the server itself. This will tell us if the problem is with external network access or something broken locally:

  • Run these commands on the company server:
    curl http://localhost:8082
    curl http://<your-server-internal-ip>:8082
    
    • If both return your expected content: The problem is external network restriction. Your company’s hardware firewall or gateway is blocking incoming traffic to port 8082. You’ll need to coordinate with your IT team to open this port in the network firewall or set up port forwarding if your server is behind NAT.
    • If either command fails: Move on to check server-side components below.

2. Confirm Nginx Listens on All Network Interfaces

Even though lsof -i TCP:8082 shows Nginx is listening, double-check it’s not only bound to the loopback interface (127.0.0.1), which would block external access:

  • Run this to inspect listening interfaces:
    ss -tulpn | grep :8082
    
    • Look for output like LISTEN 0 128 0.0.0.0:8082 0.0.0.0:* users:(("nginx",pid=xxx,fd=xx)) or :::8082 (for IPv6)—this means Nginx is listening on all interfaces.
    • If you see 127.0.0.1:8082 instead, update your server block to explicitly listen on all interfaces:
      listen 0.0.0.0:8082;
      listen [::]:8082;
      
    Restart Nginx after changes: sudo systemctl restart nginx and recheck.

3. Validate PHP-FPM Status and Socket Permissions

Your server block uses a Unix socket to connect to PHP-FPM. If PHP-FPM isn’t running or the socket has incorrect permissions, Nginx can’t process requests (this might cause timeouts in edge cases):

  • Check if PHP-FPM is active:
    sudo systemctl status php7.2-fpm
    
    • If it’s not running, start it with sudo systemctl start php7.2-fpm and enable auto-start with sudo systemctl enable php7.2-fpm.
  • Verify the socket exists and has correct permissions:
    ls -l /run/php/php7.2-fpm.sock
    
    • The socket should be owned by www-data:www-data (match the user your Nginx runs as—confirm with ps aux | grep nginx). If permissions are wrong, adjust them in your PHP-FPM pool config (usually /etc/php/7.2/fpm/pool.d/www.conf):
      listen.owner = www-data
      listen.group = www-data
      listen.mode = 0660
      
    Restart PHP-FPM after changes: sudo systemctl restart php7.2-fpm.

4. Rule Out Conflicting Server Blocks

Even though you unlinked the default server block, double-check if any other enabled sites are listening on port 8082:

  • List enabled server blocks:
    ls /etc/nginx/sites-enabled/
    
  • Check each file for listen 8082; directives. If another server block uses the same port, it might be intercepting requests. Remove or modify conflicting blocks, then restart Nginx.

5. Check for Company Network NAT/Port Forwarding

If your server uses an internal IP (e.g., 192.168.x.x) and you’re accessing it via a public IP, your company’s network might not have port forwarding set up to map the public IP’s 8082 port to your server’s internal 8082 port. Reach out to your IT team to confirm this configuration.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 06:32:03