Reputation: 6357
I've set up my ec2 instance, uploaded a test php file to var/www/html and updated the httpd.conf
file successfully as mentioned in blogs/documentation.
Now I want to view my php file in my browser. I am trying to open my Public DNS
in web browser but the browser cannot open it. Google chrome says:
Oops! Google Chrome could not connect to ec2-54-218-xxx-xx.us-west-2.compute.amazonaws.com
Did I miss something?
Upvotes: 1
Views: 2143
Reputation: 3804
Once you get into the server through terminal, I modified this file httpd.conf by terminal command "sudo vi /etc/httpd/conf/httpd.conf
" by uncommenting VirtualHost in the last few lines of the document (it is a really long document).
Under VirtualHost I also uncommented the DocumentRoot and changed its field to /var/www/html/ Now I can access this php file from the web browser by this url "myPublicDNSFromElasticIP"+/myPHPfileName. (YOU have to transfer your php file to /var/www/html/HERE in order to display it in the web or gain access from your mobile applications. You can do this by scp command in terminal)
You need to make a new PublicDNS by going into Elastic IP in the amazon Web EC2 console. so this myPublicDNSFromElasticIP is that new Public DNS from Elastic IP.
Also after you modify the file httpd.conf, you need to restart httpd I used this command in the terminal.
sudo /etc/init.d/httpd restart
And of course you need to download php from terminal using command sudo yum install php in order to get php to work
I used two websites. First website was a bit more helpful but the second from Adil was also helpful
http://www.alexkorn.com/blog/2011/03/getting-php-mysql-running-amazon-ec2/ http://www.rndmr.com/amazon-aws-ec2-easy-web-serverset-up-guide-with-a-mac-and-coda-2-256/
Upvotes: 1