OSRM安装成功后服务器无响应求助(Ubuntu 16.04/DigitalOcean)
Let's break down the possible issues step by step since you've already confirmed no local firewall is running:
Check Apache's Port Listening Configuration
Your VirtualHost is set to listen on port 8080, but Apache might not be configured to actually listen on that port. Open/etc/apache2/ports.confand ensure you have this line:Listen 8080If you add it, restart Apache with
sudo systemctl restart apache2.Enable Required Apache Proxy Modules
Apache doesn't enable proxy modules by default. You need to enableproxyandproxy_httpwith these commands:sudo a2enmod proxy proxy_http sudo systemctl restart apache2Without these modules, your reverse proxy rules won't work at all.
Verify the OSRM Service is Actually Listening
Even though the console says it's running on 0.0.0.0:5000, double-check with this command to confirm the binding:netstat -tulpn | grep osrm-routedYou should see output showing
0.0.0.0:5000(not just127.0.0.1:5000). If it's only bound to localhost, you might need to adjust theosrm-routedcommand to explicitly bind to 0.0.0.0 (though the default should do this).Enable the Apache Site Configuration
You've edited/etc/apache2/sites-available/000-default.conf, but make sure the site is enabled:sudo a2ensite 000-default.conf sudo systemctl reload apache2If you previously had a default site on port 80, this ensures your new port 8080 configuration is active.
Test Local Access to OSRM First
On the server itself, run this curl command to confirm OSRM is responding locally:curl "http://localhost:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"If this times out or returns an error, the problem lies with OSRM itself (e.g., corrupted
netherlands-latest.osrmdata files) rather than the proxy.Check DigitalOcean's External Firewall Rules
Even if your server has no local firewall, DigitalOcean's cloud-level firewall (under the Networking tab in your DO dashboard) might be blocking incoming traffic to ports 5000 or 8080. Add a rule to allow TCP traffic on the port you're using (either 5000 for direct OSRM access, or 8080 for the proxy).Fix Apache Log Permissions
If Apache isn't generating logs, the log directory might have incorrect permissions. Run these commands to set the right ownership:sudo touch /var/log/apache2/error.log /var/log/apache2/access.log sudo chown www-data:www-data /var/log/apache2/*.log sudo systemctl restart apache2This ensures the Apache process can write to the log files.
内容的提问来源于stack exchange,提问作者xfscrypt

