Help Center> Vulnerability Scan Service> FAQs> About Operations> How Do I Upload an Authentication Document to the Root Directory of a Website?
Updated on 2022-02-24 GMT+08:00

How Do I Upload an Authentication Document to the Root Directory of a Website?

During domain name authentication, you need to upload the downloaded authentication file to the root directory of the website (that is, the directory at the same level as the index file on the homepage). The file upload location varies according to the server used by the user. To upload the authentication file, perform the following steps.

Tomcat, Apache, and IIS Servers

Perform the following steps:

  1. Log in to your web server.

    If you are not the root user, run the su -root command to switch to the root user.

  2. Locate the root directory of the server, that is, the directory at the same level as the index file. Table 1 lists the root directories of common servers.

    Table 1 Root directories of common servers

    Server Used by a Website

    Root Directory

    Tomcat

    Tomcat deployment address/webapps/ROOT/

    Apache

    The default value is /var/www/html. Set the directory based on the site requirements.

    IIS

    The default value is C:\inetpub\wwwroot. Set the directory based on the site requirements.

  3. Save the authentication document to the directory found in Step 2.

    NOTE:

    The directory must be in the same level as the index file.

    Example:

    1. Run the cd root directory command to go to the root directory of the server.
    2. Run the vi hwwebscan_verify.html command to create a file with the same name as the authentication file.
    3. Run i to enter the edit mode.

      Paste the content of the authentication file here.

    4. Press Esc to exit the editing mode, and then run the :wq command to save the settings and exit.
    5. Run ll to check whether the authentication file is successfully uploaded.
      Figure 1 Example

  4. Enter domain name/hwwebscan_verify.html in the address box of the browser to check whether the authentication file is uploaded. If the file can be accessed, the upload is successful.

Nginx Servers

Perform the following steps to redirect the access to hwwebscan_verify.html to a local file:

  1. Log in to the Nginx server.

    If you are not the root user, run the su -root command to switch to the root user.

  2. Upload the authentication document to any directory (the Nginx process only has the read permission on this directory). The following uses the /opt/mock directory as an example.

    Example:

    1. Run the cd /opt/mock command to open the /opt/mock directory.
    2. Run the vi hwwebscan_verify.html command to create a file with the same name as the authentication file.
    3. Run i to enter the edit mode.

      Paste the content of the authentication file here.

    4. Press Esc to exit the editing mode, and then run the :wq command to save the settings and exit.

  3. Open the nginx.conf file and configure the location information of the HTTP module of Nginx. After the configuration is successful, you can read the authentication file from the /opt/mock directory.

    1. Run the vi nginx.conf command to open the nginx.con file.
    2. Modify the following content based on the site requirements and overwrite the original HTTP module. See Figure 2.
      http {
      default_type "application/json;charset=utf-8";
      server {
      Replace listen ${your website port};# with the actual value.
      location /hwwebscan_verify.html {
      ${user}  /opt/mock;
      }
      }
      }
      Figure 2 Configuration of location information

  4. Run the nginx -s reload command to update the configuration.
  5. Enter domain name/hwwebscan_verify.html in the address box of the browser to check whether the authentication file is uploaded. If the file can be accessed, the upload is successful.

About Operations FAQs

more