Installing Magento 2 in another folder

Hello Craig and the family.

I could not find an answer for my question in here, so let me ask you:

  • What steps do we need to do to install Magento 2 in other folder like: /var/www/html/magento/
  • or to move current installation to that folder?

I ask because I plan running other websites and this would make conflict.
Also can you cover setting an alias to that directory because I am not 100% sure about this?
It’s been a while when I was installing Magento (1) on hosting.

Thank you in advance.

Hi @Monterson and welcome

Installation Directories
Installing Magento in a directory other than the typical /var/www/html/ directory is as simple as downloading or uploading your files into your directory of choice.

  • If you’re uploading files, then upload them to /var/www/html/magento/.
  • If you’re unpacking files, then unpack them in /var/www/html/magento/.
  • If you’re downloading files via Composer then run the composer command from within /var/www/html/magento/.

Apache Virtual Hosts
If you’re planning to run multiple web applications on a single web server, then you’ll want to setup individual Apache configurations (Virtual Hosts) to reflects each directory. Eg:

  • Virtual Hosts 1 points to /var/www/html/example_1
  • Virtual Hosts 2 points to /var/www/html/example_2
  • etc…

This is a simple and generic type of setup. You’ll find loads of article on Google that will go over this in more details, such as How To Set Up Apache Virtual Hosts on Ubuntu 16.04.

Alias

I don’t understand what you’re asking.

Thank you very much Craig for your help.
The way you present your knowledge is excellent.
I can’t wait for the next video on Youtube.

Btw. One product stores are really popular novadays in the era of dropshipping.
Is there any chance you can make a video about customizing a theme for One product store?
I believe you may get a lot of viewers especially from those who are looking for alternatives for Shopify.

I’m not familiar with this term. Can you tell me a little more about it?

Hello Craig.

So you want me to bring more light on “One product store”, which is not possible without explaining an idea behind it. I will try to be as concise as possible.

A “One product store” is strongly attached to a Dropshipping model of selling which came to life about 4 years back and expand massively about a year ago.

Dropshipping
Dropshipping is a selling model, where a person through running an on-line store is selling an items that he/she do not possess, and when a customer buys an item then he/she uses the money to pay the supplier (usually from Aliexpress.com - cheap chinese suppliers) for the item and ask that supplier to send an item directly to the customer.
This model is almost risk free because the seller do not need to hold any inventory.
Obviously there are some other risks that include spending/wasting money on social media advertising.

This model let persons with little money (about $200) start their on-line business that potentially can grow a lot.
Moreover they do not need to know coding to run their stores because of existence of Shopify.
However Shopify is very expensive; charging $29 monthly per each store plus 2.9% of each transaction.

Let’s take a look at google trends about dropshipping:
https://trends.google.com/trends/explore?date=today%205-y&geo=US&q=dropshipping

Shopify Dropshipping
Now to the point. So called “Shopify dropshipping” is evolving very fast and through a “general stores” which were (well, still are) stores that sell all sorts of items not related to each other, went through specialising stores known as a “niche stores” which sells an items for closed niche (e.g. dog lovers, fitness, mothers etc.) and finally went to a kind of stores that work best, which are called “One product stores”. Customers trust that last ones a lot because they think, that company that is selling the product is a producer of it - hence they are mostly used by a professional sellers.

Newbies think that having a general store is easier because they may “test” a product whether it sells or not but this is a newbie trap because nowadays customers do not trust them. Those sellers avoid Niche store or One product store because of a few reasons:

  • not easy to change store to another - in case if products are not selling well,
  • need to buy a new domain, email addresses,
  • changing domain on existing store breaks relationship and law (warranty).

One Product Stores
One product store is a store that sells only one product (eventually offers some kind of upsell/cross sell to it). A layout of that store is usually simple and is designed around that product plus enhance customer feeling that the seller is a producer of that item.

Let me put some examples:

blendjet-com/cloudcushion-co/hexr-com/www.themagnetking-com/mosquitotrapx-com/thermallunchbox-com/mountrend-com/wolfandgrizzly-com/clevertray-store/vibrantskinco-com/ko8-fitness/coolinastore-com/

…to name a few (I tried to put more links but it allowed me to type only 2 so I put them together)

(not all of them are actually a dropshippers - some used to be and then turned into brand store where at some time start using fulfilment centre to decrease shipping times; also they put their logo on product)

Thousands of people are starting dropshipping business model everyday. Those of them who understand that One product store OR a niche store is the only working model are facing Shopify fees problem - hence looking for alternatives like Woocommerce or in my case Magento. Another problem is that shopify is very very simple and not looking so professional until customized.

Conclusion
I see, Craig a massive opportunity for you to make a series of videos on how to create a One or Niche product store for dropshipping PLUS selling your own theme PLUS offering hosting PLUS offering custom design PLUS offering private consultations especially if your way of presenting knowledge is beyond belief. Maybe you do not have a conscious of it but the way you talk is highly understandable also for people with a very poor english plus your great focus on details and natural attitude.

The best of it is that your have literally no competitors at all, and I can’t really imaging a better person to present that video series then you.

I hope I explained it well enough.
(sorry for my english - I am not native)

Oh, one more thing.
Bellow is a cherry on the top:
“For those of you who don’t know me already, my name is Crag”.
That is the best bit. Please do not forget to put it on every video.

1 Like

Thank you for taking the time to enlighten me on this concept. It’s not a business model that I’ve ever been involved with. It certainly makes much more sense to focus on a single product than a bunch of random items. Especially, when Amazon is the goto for your everyday items (well it is for me).

I’ve never associated Dropshipping models with Magento. Mostly because I’ve always paired this model with Shopify as they are both very easy to get off the ground - Especially, as Shopify is more of a built it and forget solution. Whereas, Magento is more complex and requires a lot more attention.

Plus, Magento is known for power and flexibility which isn’t normally a Dropshipping requirement. Not that I’ve ever seen anyway.

Thanks for the positive comment and informative post. I’ll bare this in mind :+1:

1 Like

Craig, (Edited)

I found a differences between commands you use when creating a new user and setting permisions and the way the others are doing this.
Can you please explain me this below?

Your version:
sudo adduser username
…and then
sudo usermod -g www-data username

Others write:
sudo usermod -aG www-data username

Also

Some use:
sudo chown username:www-data /var/www/html/mywebsite/

Others use:
sudo chown -R www-data:www-data /var/www/html/mywebsite/
sudo chmod -R 755 /var/www/html/mywebsite/

I know that this is for protection but why difference.

Thank you in advance.

Here is an explanation of each command you posted. Let me know if you have an specific questions.

User Groups
Replace Primary User Group of username (from whatever it was set to before) to www-data

sudo usermod -g www-data username

Add a User Group called www-data to any existing list of User Groups belonging to username

sudo usermod -aG www-data username

Note: In my tutorials, the “username” doesn’t need to be in multiple groups. Therefore I make “www-data” the primary. This practice can avoid issues in the future.

Change Owner (change owner > chown)

Change Owner of /var/www/html/mywebsite/ to username and the Group to www-data

sudo chown username:www-data /var/www/html/mywebsite/

Change Owner of /var/www/html/mywebsite/ (including all sub-directories) to www-data and the Group to www-data

sudo chown -R www-data:www-data /var/www/html/mywebsite/

Change Mode (change mode > chmod)

Change both the Directory and File permissions of /var/www/html/mywebsite/ (including all sub-directories) to mode 755 (i.e. User can read, write, and execute; group members and other users can read and execute, but cannot write)

sudo chmod -R 755 /var/www/html/mywebsite/

That’s wonderful Craig - clear and detailed explanations help new people like me learn from your excellent posts and videos. Thank you!

Following on from this permissions issue and the Apache Virtual Hosts that you mentioned above…

If you wanted to create 3 separate Magento installations, for 3 separate domains (each a completely different) like this…

/var/www/html/carshop/
/var/www/html/shoeshop/
/var/www/html/tentshop/

Would just the single “magento” user be okay for all 3 or would you recommend creating a separate user for each one?
I would be the only one using ftp to access all 3, so I’m thinking more about performance than permissions I guess?

Thanks,
Shaun

There’s probably a good reason to use different users that relates to security. But other than that, I don’t see why you can’t.

1 Like