How to run index.php file in amazon EC2? - php

I have been newly introduced to AMAZON EC2 Server. Recently I created a micro instance EC2 Ubuntu and installed Apache, PHP & MySql.
I have some PHP files including an index.php. I have uploaded my files to /var/www/html directory. Now when i open my Public DNS in browser it shows nothing. The same thing is working in my localhost setup.
Is there something enabling mod rewrite in EC2 Ubuntu instance ?
Please help.
Thanks in advance.

Enable inbound and outbound rules for port 80 (http) in your security group(s) that is assigned for the instance. By default the only inbound rule is ssh (port 22) and all outbound rules are enabled. So you might only need to change the inbound rule.

Related

How to setup and run a PHP WebSocket service on a cpanel-based shared hosting platform?

I have created a Chat application in Ratchet PHP. It runs fine on local machine using WAMP. I want it to setup on live server.
On my server I have:
PHP Support
SSH access
Port 9000, which is opened for OutBound connections.
Sub-domains
What I don't have:
No port for InBound connections.
No root access in SSH. Say I cannot see/edit iptables
I ran php server.php which gives success message about the server is started and listening at port 9000. But when a HTML page tries to connect it using ws://domain:9000 it runs into error-
Firefox can’t establish a connection to the server at
ws://domain.com:9000/
I googled a lot and it appears that what I need is a port for inbound connections.
But according to this answer the thing I need is PHP support for Ratchet to work on shared hostings. Can anyone explains what I really need and Is there any workaround If it's not availble in the list of things I have on my server.
Basically, No
It is not likely for a shared hosting environment (i.e. Apache with VirtualHost config, PHP, MySQL, and a CPanel interface) to support your websocket application.
For websocket to work, you need to either:
have a port dedicated to websocket in-bound connections; or
have a HTTP/HTTPS server that knows when to upgrade a connection and proxy pass to your websocket application.
The first route requires the server to allow in-bound connection to a certain port number. This is a potential security issue for the hosting provider and, thus, is unlikely for your vendor to grant you that.
The second route requires Apache server have with both mod_proxy and mod_proxy_wstunnel installed and enabled. It also require you to use ProxyPass config, which cannot be overridden by .htaccess configs at all.
So unless your hosting grants you the permission to touch the Apache main configuration (or would apply such change for you), you're pretty hopeless.
Suggestion
To run your own websocket service, you should think about using Virtual Private Server services such as Amazon EC2, DigitalOcean VPS.

Using Apache-PHP as a Runner in AWS Cloud9

I am using AWS Cloud9 as my IDE for PHP web development. I have set up the environment on AWS with all the default settings and all appears to be working. I can use the "Run" and "Preview" functions in the IDE to run my .php file. However, it is using the "PHP (Built-in web server)" as default to run.
How do I run it through Apache HTTP instead? There isn't an option in the list of Runners. I can create one, but have no idea how to. I can see that Apache HTTP is available on the default EC2, though.
There is no option in the list of runners. You have to manually configure Apache to run on ports 8080, 8081 or 8082.
This page details how to run Apache on AWS EC2 Cloud9 server (port, root directory and htaccess): How to configure and run Apache server on AWS EC2 Cloud9?

server running IIS and Apache: setting up SSL

One of my clients have a server running both IIS and Apache. IIS is on port 80 and Apache is on port 8081. I am working on an application that will be running on Apache and this application needs to be configure so that it uses SSL.
The client already purchased the SSL certificate from Godaddy but when trying to generate the CSR file, it asks for certain information like the Common Name (fully qualified domain name, or URL, you are securing. I am having from with this particular section: Common Name.
The application's URL is http://apps.patria.com.do:8081/Cobros_Online/. When I use this as the URL, it tells me it is not valid. After doing some research, it looks like it cannot contain port number. How can I fix this? I can't use the default port 80 because IIS is on port 80.
So, for example, http://apps.patria.com.do/, will take you to another application running on IIS.
What can I do to make the URL acceptable?
Thanks in advance!

EC2 (t1.micro) Windows XAMPP Can't Connect via web

I have opened a micro instance on AWS with a Windows_Server-2008-R2_SP1-English-64Bit-Base-2013.11.13 (ami-1e53c82e) virtual machine. RDS is open and I have connected with remote desktop connection. Additionally, at initialization I set HTTP (port 80), and HTTPS (port 443) although I do not know how to verify that now. From within the VM I navigated to XAMPP and installed a default installation (minus MySQL). I then navigated to XAMPP control panel V3.2.1 and started Apache. I set a password on XAMPP directory. I set a "Hello World" test txt file in htdoc and that loads in the VM browser. However, when I try to access the pubic IP, my local browser times out.
I think I covered the first three checks on
"xampp configuration in windows server 2008 r2 ec2 instance" post
but not sure how to change the elastic or private IP response if that is relevant.
If you're using VPC, you have to allow both inbound/outbound in the network ACL and inbound for the security group. You probably also have to open the ports in the windows firewall.
Edit: You definitely don't want to disable the firewall altogether. Also, it doesn't matter whether you use public ips from within AWS. And public host names resolve locally anyway.

Apache, PHP, MYSQL on Windows 7

What is the best (and easiest) way to set these up on Windows 7? I have tried Xampp and WAMP but all I get after installing them is a blank local host. So I create a php info file using the following code:
<?php
phpinfo();
?>
Put it in the httpdocs folder, call it using http://localhost/info.php and I get a 404 file not found error. Even though I followed the typical install settings.
Are you by any chance running Skype in the background? Skype claims port 80 and port 443 as a firewall workaround. You can disable this in the advanced options -> connection.
This happens to me almost all the time I set up a new PC...
The problem was not with either xampp or wamp. The problem was with the proxy that is installed where I was using the internet. It has blocked access to the localhost. Bypassing the proxy for localhost in Internet options -> Connections -> LAN Settings -> Proxy Server does not fix this for wireless so to access the webserver I have to disconnect from the network to what I need to do and then reconnect.
The web server worked fine when I was on other non proxy networks.

Categories