Magento Multi Site on Amazon Cloud - php

I'm trying to migrate our Magento to Amazon Cloud.
Currently we have this setup:
www.xyz.com (/var/www/vhosts/xyz.com/httpdocs)
This is where Magento is setup:
www.abc.com
This is where our Wordpress is setup:
www.abc.com/store/
This is a multi store setup to use the code in xyz.com with index.php calling the Magento app.
Initially, I was thinking of using 1 EC2 instance for Magento and another EC2 instances for the Wordpress. Then I would setup 2 Elastic IPs to the 2 instances and then point abc.com and xyz.com to their EIPs accordingly.
However, I can't think of a way for the /store/ folder under abc.com to use the same source code for Magento.
Could anyone advise?
Thanks.

I'm not quite sure about your needs but I would recommend to have store.abc.com as subdomain - this way you can link xyz.com and store.abc.com to the same folder and keep abc.com to the main wordpress folder. But again need to look deeper into the setup. we just transferred one of the store to amazon AWS.

Your only option is a Proxy. Everything else (Like mod_rewrite / Alias) will do a header redirect, and expose the target address to the user.
However, Apache's proxying doesn't seem to be that complicated. The most basic example is
ProxyPass /mirror/foo/ http://backend.example.com/
Note that a proxy will of course double your traffic, because every byte requested will have to be fetched from the remote machine.
Source: Sub Directory to a different server

Related

Laravel Forge - multiple sites on the same server

I have over the past months tried to learn myself about php/laravel. I have made some laravel hobby apps which i was thinking of putting on a server, so i could use them.
I am using digitalocean for the server and laravel forge for easy deployment.
My problem is that on laravel forge it says that i can add sites, but how do i add more than one site?
There is three fields to fill in: Root Domain, Project Type and Web Directory. What do i type in these fields and how do i access the site afterwards?
Root Domain: This is the domain (web address) that you want to be associated with your site (e.g. example.com).
Project Type: This is the type of application that you're wanting to be hosting. In your case it will be General PHP / Laravel.
Web directory: This is the folder of your app that you want to use as the web root. In your case this should be public/ (unless you've moved/renamed the directory or you've moved you index.php out of that directory which I don't recommend). It is generally good practice to have your web root in a sub directory so that you can easily prevent access to sensitive information by placing it in the root directory or you app.
With a Laravel site you should almost always only have to fill out the root domain field as the rest are set for Laravel by default.
Forge comes with a "default" site set up so that you can access your site with just your ip address of the server, however, if/once you've got your domain it is recommended that you delete this and then add your site/app with the domain.
To add another site you would just need to:
Point the A record of your domain to the IP address of your forge server
Fill out the form for adding a new site (in Forge)
On the next page set up forge to pull your app from your git repo.
This tutorial should give you a quick overview: https://laracasts.com/series/server-management-with-forge/episodes/13
It is part of a series should you want/need more information but please note that some of the videos are over 2 years old so some minor things might be a bit different.
Hope this helps!

Set url to level above installation directory Wordpress

I don't know if it is even possible so that's why I put my question here.
We have a webserver running a PHP application build within the Yii-framework and we have also integrated Wordpress into that application.
The root contains the Yii-application and a dir with the wordpress installation. Now I would like to know if it's possible to create a page and have it a url outside it's installation dir.
An example:
domain.com shows the Yii application index
domain.com/blog shows the Wordpress homepage
Now I want to create domain.com/foobar and the page foobar comes from Wordpress.
Is it possible and how?
Kind regards,
Pim
Your server will have been setup with your domain name. I don't know if you are using a hosted service, or a cloud based option, but either way you should be able to tell your web server to load different index.php files based on the URL.
Every single web request comes through your web server. You can tell your web server to load different php files depending on the http request URL.
For example, when you setup your sever with domain.com you would have had to (or in most cases its the default) tell your web server to route all domian.com requests to /public/index.php
Following this logic, if you want to load a different index.php file from a different URL, you just have to set this up in your web server. So domain.com/foobar would point to /some/directory/public/index.php
The way you do this very much depends on your server and if you have some server admin software installed e.g. cPanel.

Route/create a sub-domain in CakePHP, how to

I've tried solutions as such, but they don't see to address the problem Im at.
How to create a sub-domain in CakePHP?
I have a CakePHP app in publichtml/lastroarte.com running ok. I went to my DNS and created for a subdomain entries for sandbox.lastroarte.com a test subdomain for the new version of my which we'll be upload the new app.
If I browse to the subdomain now, it redirects me the home page of my domain, still displaying the url sandbox.lastroarte. I've found entries for the pages in the Routes file of Cake, although I have not found way to say a subdomain should display the index of its own folder (public_html/sandbox.lastroarte.com). Am I doing the right approach? How to achieve this?
Appreciate your answers.
(Assuming you are running apache as your web server)
You have created a sub-domain, but have you created sites-available and sites-enabled files and restarted apache?
If you are using your host's control panel it will do this for you, but you will need to associate your public_html/sandbox.lastroarte.com directory to the sandbox.lastroarte.com sub-domain.
In short this doesn't sound like a Cake routing problem, it sounds like apache is routing traffic from sandbox.lastroarte.com to lastroarte.com.

Run app.mydomain.com as mydomain.com/app on Heroku

I have a PHP app running on Heroku (app.herokuapp.com) and it is currently being pointed to app.mydomain.com. My question would be:
Is it possible to run app.mydomain.com at mydomain.com/app? Basically I would like the app to run in a subfolder as opposed to a subdomain.
Any help is greatly appreciated.
Thank you!
You cannot in a clean way (you could with iframes, but shouldn't go that way) point your application to a subdirectory in an other application.
That is because when not using the x.herokuapp.com domain name, you need to use custom domains. These relies on DNS entries to point to an application or an other.
And you cannot create DNS entries for a subdirectory.
What you could do though, is package one application at example.com, inside which you display whatever you want for the / url, and you load your application at the /app url.

Using AWS services to create subdomains on the fly to host a site on S3

INFO: I am working on an app built in php which facilitates users to create HTML templates and publish them on web.As the templates would be static I thought of using amazon S3 for storing them as it can host static websites and has good infrastructure overall for the application.br/>
QUERY: I am facing an issue while publishing it to the web.I want the template to be published as a subdomain on my domain,for eg: I own www.ABC.com,I ask the user to name the template,if he names it as mysite,I publish his template as mysite.ABC.com(similar for all users).Now,I can store the template in the S3 bucket using putObjectFile in the aws s3 api,but I am not sure how can I create a subdomain(on the fly) and publish it on that domain.(I want to automate the process for the user). Also,can I make the bucket as hosting static website using the API?
Earlier,I worked with cpanel and cpanel API's allow us to create domains and do a FTP to the domain with the content,I am not clear how can I achieve it here.
RESEARCH: The success till now I have achieved is,I have hosted a site using the S3 console.Using the AWS services I have moved the files to a bucket with the name same as the subdomain of the user.I want now to have the bucket endpoint changed to the subdomain.
REFERENCE: This website does the same,they create a directory like structure and publish the website on web.I don't know if they host it on Amazon,but I want to achieve something similar.Hope I am clear and get some guidance.
Thank you for the attention
I researched a similar scenario some time ago but I was unable to use S3 for this because of a S3 limitation.
To host a static website on S3 on a custom domain or subdomain, you need to create a bucket with a name that matches that domain. And because each S3 account is limited to 100 buckets, you will only be able to host those many domains or subdomains on a single account.
Based on the use case you described, I suspect this S3 limitation will also force you to find another solution.
In my case, the solution was to set up an EC2 instance that proxies requests to S3 after rewriting them. For example if someone requests:
http://mysite.abc.com/file.html
that goes through our EC2 server where the request is rewritten and forwarded to S3 as something like:
http://ourbucket.s3.amazonaws.com/mysite.abc.com/file.html
UPDATE:
There are several proxy servers that you could use for this but I would recommend nginx as it worked great in our case. To get started, check out the following nginx docs:
http://wiki.nginx.org/HttpRewriteModule
http://wiki.nginx.org/HttpProxyModule

Categories