I am running Amazon linux Micro instance.I have configured php,apache and phantomjs in the instance.
When i first accessed the server from a browser 'Avast' antivirus threw me a popup that this site has trojan.
Please help me out.
Easy fix. Don't host trojans from an Amazon EC2 instance; RBN is much better for that sort of thing anyway.
Assuming you aren't actually serving up malware from your site, this can be caused by the use of a database of bad IPs Avast is using that's just not up to date - the last guy at the IP you were assigned may have been serving up malware.
Check your site with other AV vendors, and if it's actually clean, wait and/or contact Avast to get your IP off their bad IP list.