Ubuntu 20.4部署Zammad后无法通过远程IP访问问题求助
Hey there, let's work through this remote access issue step by step. You've already set the server_name to your server's IP, but it looks like your Nginx configuration is missing critical reverse proxy rules to forward traffic to Zammad's backend services. Plus, we'll need to rule out firewall and network connectivity issues. Here's what to do:
1. Fix Your Nginx Configuration
Your current zammad.conf only sets up basic listening settings, but doesn't tell Nginx how to route requests to Zammad's Rails server or WebSocket service. Update your server block with the full reverse proxy rules:
# # this is the nginx config for zammad # upstream zammad-railsserver { server 127.0.0.1:3000; } upstream zammad-websocket { server 127.0.0.1:6042; } server { listen 80; listen [::]:80; server_name 10.20.60.200; server_tokens off; # Hide server version info for security root /opt/zammad/public; access_log /var/log/nginx/zammad.access.log; error_log /var/log/nginx/zammad.error.log; client_max_body_size 50M; # Reverse proxy for Rails app location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://zammad-railsserver; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } # Direct access to static assets (improves performance) location ~ ^/(assets|robots.txt|humans.txt|favicon.ico)$ { expires max; add_header Cache-Control public; } # WebSocket specific routing location /ws { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://zammad-websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
This config tells Nginx to forward regular requests to Zammad's Rails server (port 3000) and WebSocket traffic to the dedicated WebSocket service (port 6042)—both are essential for Zammad to work properly remotely.
2. Verify Nginx Configuration & Restart Services
After updating the config, check for syntax errors first:
sudo nginx -t
If you see "test is successful", restart Nginx to apply changes:
sudo systemctl restart nginx
Also, make sure all Zammad services are running as expected:
sudo systemctl status zammad
You should see zammad-web, zammad-websocket, and zammad-worker listed as active (running).
3. Open Port 80 in UFW Firewall
Ubuntu 20.04 uses UFW by default, so you need to allow incoming traffic on port 80 (the port Nginx is listening on):
sudo ufw allow 80/tcp
Verify the rule is active with:
sudo ufw status
You should see a line like 80/tcp ALLOW Anywhere.
4. Check Network Connectivity
- Confirm your server's IP is indeed
10.20.60.200by runningip aon the server. - From the remote machine, try pinging the server IP:
ping 10.20.60.200. If ping fails, there's a basic network issue (e.g., incorrect subnet, router settings) that needs fixing first. - If you're trying to access from outside your local network, ensure your router has port forwarding set up to send port 80 traffic to your server's internal IP.
5. Check for Port Conflicts
Make sure no other service is using port 80 (which would prevent Nginx from listening properly):
sudo lsof -i :80
Or:
sudo netstat -tulpn | grep :80
If you see a service other than nginx listed, stop that service or modify Nginx to listen on a different port (not recommended unless necessary).
After completing these steps, try accessing Zammad from the remote machine using http://10.20.60.200 again—it should work now!
内容的提问来源于stack exchange,提问作者Jonibek

