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

Bluehost通过cPanel部署Node.js+Express应用后域名仅显示Index of/的问题排查求助

Troubleshooting Node.js+Express Deployment on Bluehost cPanel

Hey James, you’re absolutely right—you’re so close to getting this working! Let’s break down the likely issues and fix them step by step:

1. Verify Domain Mapping in cPanel’s Application Manager

The most common culprit here is that your domain deltadesigns.co isn’t mapped to your Node.js application yet. Here’s how to check:

  • Log into your cPanel account and navigate to the Node.js Selector or Application Manager (the name might vary slightly depending on your Bluehost plan).
  • Locate the Node app you registered for your project, then click Manage.
  • Look for the Domain Mapping section. If deltadesigns.co isn’t listed here, click Add Domain, select your domain from the dropdown, and confirm the root path points to your DeltaDesigns22 directory (where your app.js lives).
  • Ensure the Application URL is set to your main domain, not a subdirectory path.

2. Check Your .htaccess Configuration (Critical!)

Bluehost relies on .htaccess to route domain requests to your Node.js server. If this file is missing or misconfigured, your domain will just show the default directory index.

  • Navigate to your domain’s document root (usually public_html, or the folder assigned to deltadesigns.co in cPanel’s Domains section).
  • Create or edit the .htaccess file and add these rewrite rules to proxy all requests to your Node server:
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:3000/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:3000/$1 [P,L]
  • Save the file and refresh your domain. Note: If the Application Manager already generated a .htaccess for you, double-check it has similar proxy rules—don’t duplicate them.

3. Confirm Your Node App is Running & Configured Correctly

  • Go back to the Application Manager for your app and make sure the Status shows as Running. If it’s stopped, click Start.
  • Verify the Startup File is set to app.js and the startup command matches what you tested manually: /opt/cpanel/ea-nodejs10/bin/node app.js.
  • Quick check: Update your Express app’s listen code to ensure it’s accessible to the local proxy. Change your app.listen line to:
app.listen(3000, '0.0.0.0', () => {
  console.log('Server running on http://0.0.0.0:3000');
});

Restart the app after making this change.

4. Double-Check Your Domain’s Document Root

  • In cPanel, go to Domains > Domains and find deltadesigns.co.
  • Check the Document Root setting. It should point to your DeltaDesigns22 directory (not the parent public_html folder). If it’s set to public_html, update it to public_html/DeltaDesigns22 (adjust the path if your folder is in a different location).

5. Test with Fresh Cache & External Tools

  • Clear your browser’s cache (press Ctrl+F5 to force a hard refresh) or open your domain in an incognito window—sometimes old cached directory listings stick around.
  • Run curl http://deltadesigns.co from a local terminal (not just the WHM server) to see what response you get. If it still returns the directory index, the issue is definitely on the server side.

Give these steps a try, and I bet one of them will get your Express app loading correctly at deltadesigns.co!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 09:12:30