Azure Ubuntu虚拟机部署Neo4j社区版后无法通过浏览器访问的排查请求
Let's walk through troubleshooting this ERR_CONNECTION_REFUSED error step by step—here's what to check to get your Neo4j Community Edition accessible via browser from outside your Azure Ubuntu 18.04 VM:
Start by checking if the Neo4j service is active and healthy:
- Run
sudo systemctl status neo4j—you should seeactive (running)in green. If it's stopped or failed, start it withsudo systemctl start neo4jand set it to auto-start on boot withsudo systemctl enable neo4j. - To dig into startup errors, view real-time logs with
sudo journalctl -u neo4j -f—look for lines mentioning failed bindings, missing dependencies, or configuration issues.
It’s easy to miss a comment or typo in neo4j.conf—verify these critical settings:
Open the config file with sudo nano /etc/neo4j/neo4j.conf and ensure these lines are uncommented (no leading #) and set correctly:
dbms.connector.http.listen_address=0.0.0.0:7474 dbms.connector.bolt.listen_address=0.0.0.0:7687
Also, check for dbms.default_listen_address—if this is set to a specific IP (not 0.0.0.0), it will override the individual connector settings. Either comment this line out or set it to 0.0.0.0.
After making changes, restart Neo4j to apply them: sudo systemctl restart neo4j
Azure’s NSG rules don’t override Ubuntu’s built-in firewall. Even if you didn’t explicitly enable ufw, it might be active by default:
- Check status with
sudo ufw status - If active, allow incoming traffic on Neo4j ports:
sudo ufw allow 7474/tcp sudo ufw allow 7687/tcp sudo ufw reload
You mentioned adding a rule for 7474, but let’s confirm it’s configured correctly:
- Priority: Ensure no higher-priority deny rule is blocking traffic (deny rules take precedence over allow rules)
- Source: If you restricted the source to a specific IP, make sure your local machine’s public IP is included. For testing, temporarily set it to
0.0.0.0/0(remember to lock this down later for security) - Protocol & Port: Confirm it’s set to
TCPand port7474(include 7687 too if you plan to use Bolt connections) - Association: Verify the NSG is attached to your VM’s network interface or the subnet it’s deployed in
Rule out service-level issues by testing from inside the VM:
Run curl http://localhost:7474—if you get a response with Neo4j’s welcome page HTML or JSON, the service is working locally, and the problem is network-related. If this fails, go back to checking service status and configs.
Neo4j 4.x and newer require Java 11—double-check your version:
Run java -version—you should see output like openjdk version "11.0.x". If you have a different version, install Java 11:
sudo apt update sudo apt install openjdk-11-jdk
Set it as the default Java version with sudo update-alternatives --config java and select the Java 11 option.
Make sure no other process is using port 7474:
Run sudo ss -tulpn | grep 7474—if another process is listed, stop it or modify Neo4j’s port in neo4j.conf (e.g., change 7474 to 7475), then update your firewall and NSG rules to match.
内容的提问来源于stack exchange,提问作者user13469785

