Deploying AcuSensor for PHP - AWS Elastic Beanstalk

AWS Elastic Beanstalk allows you to deploy a web application that can scale to match end-user demand. This simple example will demonstrate how you can deploy AcuSensor together with your web application into AWS Elastic Beanstalk.

Create your Target in Acunetix

For this example, we will assume that the URL for your target is http://eb.acunetixexample.com.

  1. Create a Target with your URL.
  2. Enable AcuSensor for the Target.
  3. Download the AcuSensor agent file acusensor.php and save this file for use later on.

Define the web application source bundle

This simple web application will be defined through the following file structure:

  • /.ebextensions/
  • /.ebextensions/acusensor.config
  • /acusensor/
  • /acusensor/acusensor.php
  • /public/
  • /public/index.php
  • /public/test.php

  1. Create the folders for your source bundle:

mkdir ~/axexample

mkdir ~/axexample/.ebextensions

mkdir ~/axexample/acusensor

mkdir ~/axexample/public

  1. Create your ~/axexample/.ebextensions/acusensor.config file to read as follows:

files:

  "/etc/php.d/acusensor.ini" :

    mode: "000755"

    owner: root

    group: root

    content: |

      auto_prepend_file=/var/www/html/acusensor/acusensor.php

  1. Create your ~/axexample/public/index.php file to read as follows:

<?php

    echo "<h1>Test PHP Site Example for AWS Elastic Beanstalk</h1>";

    echo "<br>";

    echo "Welcome to the main page.";

    echo "<br>";

    echo "<a href='test.php'>Go to the test page.</a>";

?>

  1. Create your ~/axexample/public/test.php file to read as follows:

<?php

    echo "<h1>Test PHP Site Example for AWS Elastic Beanstalk</h1>";

    echo "<br>";

    echo "Welcome to the test page.";

    echo "<br>";

?>

  1. Copy the acusensor.php file into ~/axexample/acusensor/acusensor.php.

  1. Build the source bundle with:

cd ~/axexample

zip -rq axexample.zip .

Deploy your web application to AWS Elastic Beanstalk

  1. From your AWS Dashboard, navigate to Elastic Beanstalk > Environments.

  1. Click Create a new environment.

  1. Set your environment tier to Web server environment. Then click Select.

  1. Set the Application name field to the name of your web application. In this example, we used the name axexample-php.

  1. Set the Platform dropdown to PHP.

  1. Enable the Upload your code option, then click Choose file.

  1. Select your source code bundle for upload, then click Configure more options.

  1. In the Software panel, click Edit.

  1. On the Modify software page, set the Document root field to /public.

  1. Scroll down to the bottom of the Modify software page and click Save.

  1. Scroll down to the bottom of the Configure environment page and click Create environment. AWS Elastic Beanstalk will now create your environment. This can take a few minutes.

  1. When the process is complete you will be sent to your environment's dashboard. Take note of your environment's new URL which was created automatically by AWS Elastic Beanstalk. You will need this to create a CNAME to point to this URL.

  1. Create a CNAME for your Target URL to point to your environment's new URL. In our example below we used the Namecheap cPanel interface to create a CNAME for eb.acunetixexample.com to point to axexamplephp-env.eba-uyafmbt5.us-east-1.elasticbeanstalk.com.

  1. Once the CNAME record has been added (giving time for DNS records to propagate), you can see the web application you have created by browsing to your URL (in this example http://eb.acunetixexample.com).

Test and scan your web application

  1. Point your browser to your web application (in this example, http://eb.acunetixexample.com) to confirm it is running as intended. 

  1. Run a scan on your Target. The Activity panel will confirm that AcuSensor was detected and used for the scan.

 

« Back to the Acunetix Support Page