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

OSRM安装成功后服务器无响应求助(Ubuntu 16.04/DigitalOcean)

Troubleshooting OSRM Access & Apache Reverse Proxy Issues on Ubuntu 16.04

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.conf and ensure you have this line:

    Listen 8080
    

    If 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 enable proxy and proxy_http with these commands:

    sudo a2enmod proxy proxy_http
    sudo systemctl restart apache2
    

    Without 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-routed
    

    You should see output showing 0.0.0.0:5000 (not just 127.0.0.1:5000). If it's only bound to localhost, you might need to adjust the osrm-routed command 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 apache2
    

    If 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.osrm data 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 apache2
    

    This ensures the Apache process can write to the log files.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 06:34:43