Upload php application to amazon? - amazon-web-services

I have a .php application that i would like to be able to run from any browser.
This application is sending push to mobile phone using ssl .
I have a website in amazon, and i have changed the index.html file to my file index.php ( did that in my website bucket ).
Now its not working, and i guess its because a .php application needs to use another service .
My question is what amazon service i have to use, to be able to upload and run my .php file as quickly as possible. (the file uses a certificate .mem file )
I could see you have a php sdk , and i can figure out if i need that . They have a lots of guides there .

AWS S3 is for static files only. It will serve your php as if it's simply a file, it does not execute programs.
Your choices for PHP on AWS are to use Elastic Beanstalk or to configure your own EC2 instance.
There are many nuances to this, especially the EC2 approach.

Related

URL rewrites or redirections in AWS Elastic Beanstalk (with Spring Boot application)

I have a Spring Boot application hosted on AWS Elastic Beanstack.
In the application properties I have:
server.servlet.context-path=/PartToRemove
so all my URL are:
https://example.com/PartToRemove/path/to/the/particlar/endpoint
Now I would like to remove the PartToRemove to have:
https://example.com/path/to/the/particlar/endpoint
At the Spring Boot level it is easy - I just need to remove line
server.servlet.context-path=/PartToRemove
from my configuration.
BUT
... I would like to keep "backward compatibility" for all users who know the old URLs only. So I was thinking about setting some rewrite or redirection from the old https://example.com/PartToRemove/path/to/the/particlar/endpoint to the new https://example.com/path/to/the/particlar/endpoint URLs.
I'm not very familiar with AWS so I'm not sure where to do this. I was thinking about something like mod_rewrite in .htaccess file but I have no idea if it is a proper way.
I'm deploying the application as a zip file so I can use .ebextensions if it would help.
Any ideas on how to achieve such redirection or rewrite?

Deploy simple PHP website to Swisscom Application Cloud: how to configure the server?

I am trying to deploy a simple PHP website to the Swisscom Application Cloud, based on cloud foundry.
My website is working fine locally, served by Apache.
I have followed the tutorial, but I am not clear on some aspects.
In the tutorial, the way to check if the app is working normally is to run it in the built-in web server in php through php -S. This doesn't work for me because my website has html extensions for php files and these are not interpreted correctly by the built-in server. In Apache, I can configure that just fine in the httpd.conf file, but here I don't know how to configure such a behaviour.
That's fine by me, because I can still check the website locally serving via Apache. The problem is that it looks that in the cloud this is the way to run the app as well, although I couldn't find more info in the documentation.
I'd be surprised that this is how the app is run in production because the php documentation states the following about the built-in server:
"It is not intended to be a full-featured web server. It should not be
used on a public network."
Are the web apps being run on Apache in the Swisscom Application Cloud? If yes, how do I get access to configure the httpd.conf and php.ini files? If no, how can I configure the special behavior I need for my app?
UPDATE:
Here is a sample php app which summarizes what I am trying to achieve: deploy it in cloud foundry interpreting html files as php files.
https://github.com/atineoSE/sample-php-app-cloudfoundry
Following #daniel-mikusa 's links to documentation I added special config related to the mime types under .bp-config/httpd/extra/httpd-mime.conf. This doesn't work as expected, though. Accessing from firefox, I am prompted to download the file. It works fine when I serve it locally via Apache with the same directive in the httpd.conf file.
The PHP build pack does not use php -s. I suppose that you could, but it's not the default. The default setup is to use PHP-FPM & Apache HTTPD, or ou can optionally use PHP-FPM w/Nginx.
For the most part, the PHP build pack should just run your app. There are occasionally things you need to adjust, and they are easily configurable by adding .bp-config/options.json to the root of your app.
I don't know anything about your app though, so I can't really say. If you can't get what you need with options.json you can customize the configuration for HTTPD, Nginx or PHP too. Check out the docs here for instructions to do that.
http://docs.cloudfoundry.org/buildpacks/php/gsg-php-config.html#engine-configurations
Hope that helps!

AWS - Elastic Beanstalk/Glassfish index.html file

I am using Amazon's AWS Elastic Beanstalk to deploy my web application. I am having a problem where the deployed application will display a "Your server is now running" page, rather than my own index.html/jsp page. What I am really confused about is that this appears to happen at random - sometimes my deployment will work fine, but others I will get this page.
Is there a specific configuration or directory structure I need to use in order to make my index.html the default? I had previously had my project configured for Tomcat, and am using a regular .war file directory structure.
Any help is appreciated

routing subfolder on S3 to wordpress blog on EC2 microsoft server

I'm using Amazon S3 to host static files for my website. Now I wanted to add Wordpress blog, which would be hosted in /blog subfolder. I followed an article which explains the easiest way to install Wordpress on EC2 on Microsoft Windows server here:
http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/EC2Win_CreateWordPressBlog.html
I'm wondering how can I set /blog/* subfolder of my static site on S3 to rewrite all urls to a blog hosted on EC2.
How is that possible?
Thanks for help
As far as I know that's not possible. S3 supports redirects, but it won't act as a proxy for your dynamic content as there's no concept of URL "rewriting" (which can only really happen at the webserver level unless you're redirecting to a completely different domain). You have a few alternatives though.
Host your wordpress blog on a subdomain. blog.yourdomain.com keeps your blog and you just link to it from your static site.
Find a way to generate static files from your wordpress blog and put those files in the blog "subfolder". There are wp plugins that will do this I believe.
Just thought of a new one. Set up cloudfront in front of your website and use behaviors to forward requests to your blog server.
There is a final option where you make your default 404 page into a little js application that acts as a router for fetching pages from your wordpress backend but hahahahaha don't do that.

EC2 web application folder structure

I have a web application which is currently working fine on my local machine and I am now trying to get it to work on EC2.
I transferred the index.php file into the folder /var/www and I am able to access it by visiting my elastic IP (for example, http://123.45.678.910/ ).
The trouble is that I also added the folder named restAPI into the folder /var/www which in turn has several files. When I try to access restAPI/index.php by going to the URL - http://123.45.678.910/var/www/restAPI/index.php, it gives me a 404 error.
There are two things at play here:
The file system path
The URL path
If you're running an Amazon Linux image, your web content should be deployed inside /var/www/html -- as is the case with just about every reasonable Linux installation.
If your index page is stored at /var/www/html/index.php, then your URL will be http://123.45.678.910/index.php.
If you're trying to access http://123.45.678.910/var/www/restAPI/index.php, it means that you uploaded your file to /var/www/html/var/www/restAPI/index.php.
Make sense?