Configuring FTP Credentials for Hawk.js

Hawk.js uses an FTP server to upload essential files, such as the authorization file for IndexNow and sitemaps for Google strategies, directly to your web server. Proper configuration of your FTP server and credentials is critical for these features to function seamlessly.


Consideration

  • Hawk.js uploads files directly to the root directory of your FTP server, which must match the web server’s root directory (e.g., public_html or /var/www/html).
  • Hawk.js does not navigate between directories on your FTP server. It simply uploads files to the home directory (primary directory) of the FTP connection.

Steps to Set Up an FTP Server

1. Check FTP Support on Your Hosting Plan

Most hosting providers offer FTP server support, but some plans may exclude it. Ensure your hosting plan includes FTP access by:

  • Reviewing your hosting plan’s features.
  • Consulting with your hosting provider if FTP access is unclear.

2. Set Up an FTP Account

You can create an FTP account via your hosting provider’s control panel. Depending on your provider, this may be:

  • cPanel
  • HPanel (for Hostinger users)
  • Custom Dashboard (specific to your hosting provider)

3. Configure FTP Credentials

While setting up your FTP account, you will define the following details:

  • Hostname: The domain name or IP address of your FTP server. Example: ftp.example.com or 192.168.1.1.
  • Username: The username for your FTP account.
  • Password: The password for your FTP account.

Integrating FTP Credentials into Hawk.js

After creating your FTP account, update the hawk.config.js file with the credentials:

/** @type {import("@cresteem/hawk-js").hawkJsOptions} */
const config = {
    ftpCredential: {
        username: "your-ftp-username",
        password: "your-ftp-password",
        hostname: "ftp.example.com",
    },
};
exports.default = config;

Best Practices for FTP Configuration

  1. Match FTP and Web Server Roots:
    Ensure the FTP root directory is the same as the web server’s root directory. For example, if your web server uses /public_html as its document root, configure FTP to use the same directory.

  2. Secure Your Credentials:
    Store your FTP credentials securely and avoid sharing them unnecessarily. Ensure the hawk.config.js file is not accessible to unauthorized users.

  3. Verify File Uploads:
    After setting up Hawk.js and running a strategy requiring FTP (e.g., IndexNow), verify that the uploaded files are correctly placed in the server’s root directory.


Common Hosting Scenarios

Hosting ProviderFTP AvailabilityControl Panel
HostingerYesHPanel
BluehostYescPanel
GoDaddyYesCustom Dashboard
AWS EC2No (Requires Manual Setup)AWS Management Console
Google CloudNo (Requires Manual Setup)Google Cloud Console

Keywords:

  • FTP Credentials
  • Hawk.js
  • FTP Server Setup
  • IndexNow
  • Google Sitemap
  • File Upload
  • FTP Configuration
  • Web Server Root Directory
  • Secure FTP Setup