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

如何在Ubuntu 18.04上部署Hyperledger Fabric Composer REST API公网访问

Hey there! Let's walk through getting your Hyperledger Fabric app accessible to other users on your local network step by step—no need to stress if you’re new to Apache or Ubuntu, we’ll break everything down simply.

Step 1: Make your app listen to all network interfaces

Right now, your app is probably only bound to localhost (127.0.0.1), which means it can only be accessed from your Ubuntu machine itself. We need to change that so it listens to all available network interfaces:

  • Locate your app’s startup configuration (if it’s a Node.js app, for example, look for a line like app.listen(8080, '127.0.0.1')).
  • Modify it to listen on 0.0.0.0 instead: app.listen(8080, '0.0.0.0').
  • Restart your app, then test locally with curl http://<your-ubuntu-machine-ip>:8080 to confirm it’s reachable via your machine’s actual IP.

Step 2: Open the port in Ubuntu’s firewall

Ubuntu 18.04 uses ufw by default, so we need to allow incoming traffic on port 8080:

  • Run this command to open the port:
    sudo ufw allow 8080/tcp
    
  • Verify the rule is active with:
    sudo ufw status
    
    You should see a line allowing 8080/tcp in the output.

Step 3: Test access from another local machine

Grab another device on your LAN, open a browser, and enter http://<your-ubuntu-machine-lan-ip>:8080. If it loads your app, you’re already halfway there!

  • If it doesn’t work:
    • Double-check your Ubuntu machine’s LAN IP (run ip addr show and look for the inet entry under your main network interface, like enp0s3).
    • Confirm your app is really listening on 0.0.0.0 with netstat -tulpn | grep 8080—the output should show 0.0.0.0:8080, not 127.0.0.1:8080.

Step 4: Use Apache as a reverse proxy (optional, for port 80 or custom domains)

If you want users to access your app without typing a port number, or use a custom local domain, Apache reverse proxy is the way to go. Here’s how to set it up:

  1. Install Apache first:
    sudo apt update
    sudo apt install apache2
    
  2. Enable the required Apache modules for proxying:
    sudo a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests
    
  3. Create a virtual host configuration file:
    sudo nano /etc/apache2/sites-available/fabric-app.conf
    
    Paste this content, replacing placeholders with your details:
    <VirtualHost *:80>
        ServerName fabric-app.local # Optional: use a custom local domain
        ServerAdmin your-email@example.com
    
        # Forward traffic to your app's local port
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:8080/
        ProxyPassReverse / http://127.0.0.1:8080/
    
        # Log settings
        ErrorLog ${APACHE_LOG_DIR}/fabric-app-error.log
        CustomLog ${APACHE_LOG_DIR}/fabric-app-access.log combined
    </VirtualHost>
    
  4. Enable the virtual host and restart Apache:
    sudo a2ensite fabric-app.conf
    sudo systemctl restart apache2
    
  5. Open port 80 in the firewall (if not already open):
    sudo ufw allow 80/tcp
    
  6. Now users can access your app via http://<your-ubuntu-machine-ip> or http://fabric-app.local (if you set up local DNS for the custom domain).

Quick Troubleshooting Tips

  • If Apache proxy isn’t working: Check the error log at /var/log/apache2/fabric-app-error.log for configuration or permission issues.
  • If LAN access still fails: Make sure your router isn’t blocking traffic to your Ubuntu machine, and that Hyperledger Fabric’s core services are running properly.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.12 05:16:34