从开发到生产环境:Web应用上传操作求助
Hey there! As someone who’s walked tons of new freelance devs through getting their apps live on A2Hosting, let’s break this down into simple, actionable steps—you’ll have your site up in no time.
先做个小准备
Before diving in, double-check your web app’s file structure: A2Hosting uses public_html as the web root directory—this is where all files that need to be publicly accessible (like index.html, CSS/JS folders, frontend assets) should live. If you have backend files (like PHP scripts or configs), they’ll either go in public_html or a parent folder (stick to public_html for your core frontend first to keep things simple).
方法1:用A2Hosting的File Manager(最适合新手)
This is the easiest way if you don’t want to install extra tools:
- Log into your A2Hosting cPanel (you should’ve gotten the login link, username, and password in your welcome email).
- Look for the File Manager icon (it looks like a folder) and click into it.
- Find the
public_htmlfolder in the left sidebar—this is your target directory. - Click the Upload button in the top toolbar. You can either drag-and-drop your app’s files/folders directly into the upload area, or click "Select File" to pick files from your computer.
- Once uploads finish, head back to
public_htmlto make sure all your files are in place (no missing folders or misplaced assets!). - Now type your domain into a browser—your app should load! If not, check if your main entry file (like
index.html) is directly inpublic_html(not nested in a subfolder).
方法2:用FTP工具(比如FileZilla,适合频繁更新)
If you plan to make regular changes to your app, FTP is more efficient for repeated uploads:
- Download and install FileZilla (it’s free and beginner-friendly).
- Open FileZilla and fill in the top bar with your FTP details:
- Host: Either your domain (e.g.,
ftp.yourdomain.com) or the FTP server address listed in A2Hosting’s cPanel. - Username: Your cPanel username (or a dedicated FTP user you create in cPanel’s FTP Accounts section).
- Password: Your cPanel/FTP user password.
- Port: Use 21 for regular FTP, or 22 for SFTP (more secure—A2Hosting supports both).
- Host: Either your domain (e.g.,
- Click Quickconnect to link to your server.
- The right pane shows your server’s file system—navigate to
public_html. - The left pane is your local computer’s files—find your web app folder, then drag-and-drop all its contents into the right pane’s
public_html. - Wait for the upload to finish, then test your domain in a browser.
方法3:用Git部署(适合代码版本控制用户)
If you use Git to manage your app’s code, this makes future updates super quick:
- Log into cPanel and find the Git Version Control icon.
- Click Create, name your repository, set the Deployment Path to
public_html, then hit "Create Repository". - Copy the SSH or HTTPS URL of your new cPanel Git repo.
- On your local computer, open your app’s project folder in a terminal, then add the remote repo:
git remote add a2hosting [your-cpanel-git-url] - Push your code to the server:
git push a2hosting main - cPanel will auto-deploy your code to
public_html—visit your domain to see it live!
常见问题排查
- 404 Error: Make sure your main entry file (
index.html,index.php, etc.) is directly inpublic_html. cPanel looks for these filenames first—if yours is named something else, adjust the "Index Manager" setting in cPanel to add your custom entry file. - PHP/Node.js Apps: Confirm A2Hosting supports your app’s language version. For PHP, use cPanel’s Select PHP Version tool to switch to the right version. For Node.js, use cPanel’s Node.js Selector to set up your app and specify the start file.
- File Permission Issues: If some files won’t load, check permissions. Most frontend files (HTML/CSS/JS) should be set to
644, folders to755. In File Manager, right-click a file > Change Permissions to adjust.
内容的提问来源于stack exchange,提问作者Rafael Marques

