Blog

Easiest way to install Magento 2 in NGINX VPS

Magento is fast growing E-commerce Platform with good security and standard. But when it comes to usage, It’s a little bit complicated one from installing to managing and also Magento expects luxury server configuration. If you have any idea on installing Magneto in shared hosting, Just kick it off and start using dedicated or VPS server. And of course, they are bit costlier at the same time there are some affordable service providers like Digital Ocean, Bluehost. Digital ocean is providing Free $10 credit for the new users, You may get the offer with this link. So here we see the easiest way to install Magento 2 in NGINX server.

Magento 2 – Setting up Server

Let’s check on installing Magento 2  with Digital Ocean server. Get an account with Digital Ocean and create a New Droplet there.

  1. Select Distributions
  2. Ubuntu 16.04
  3.  $10 / mo ( For Magento we need minimum $10 plan and you may choose $10 or above if required ),
  4. There is nothing to do with Add block storage
  5.  Choose Data center region which one is suitable for the Magneto 2 Installation requirement
  6. Don’t forget to add SSH key which is very important to play with VPS server. You can generate SSH key with PUTTYGEN.
  7. Download and Install PUTTY and open PUTTY GEN and click on Generate then move the mouse over the blank area.
  8. Enter Key passphrase which is like Password and save both the public and private key
  9. Upload the private key in Digital Ocean SSH area

Let’s play with Magento 2 using PUTTY

Now we have created a Virtual Private server to Install Magento 2 with NGINX. To play with the server, We need the PUTTY tool to connect. Get Putty from www.putty.org and install it in your system.

  1. Open Putty and enter the IP Address which you can find in your droplet

2. Add the SSH file by selecting SSH -> Auth -> Browse .ppk file which is used in digital ocean and click on open

3. If the private key is authenticated properly, It will connect to the server and ask for login user. Login as “root” and enter the passphrase if you have entered while generating the “.ppk” file.

4. Now we have connected successfully to the server using PUTTY. Let’s start the game.

Install Magento 2 in NGINX VPS

Now we are going to install Magento 2 in NGINX with below commands. The interesting part is, We don’t have to install NGINX, MYSQL, MAGENTO 2 one by one. It’s all can be installed by executing the below commands. To paste the command in PUTTY, just copy by using Ctrl + C command and right click on putty.

  1. Update Ubuntu
     sudo apt-get update
  2. Install Git
     sudo apt-get install git
  3. Clone the configuration
    git clone https://github.com/DavidBelicza/magento2-server-configuration.git
  4. Get into configuration Directory  ( cd m and hit TAB )
    cd magento2-server-configuration
  5. Edit Configuration
     nano install.ini
  6.  Domain, base URL to be replaced with the IP address which can be found in Digital Ocean droplet
  7. Get the Magento connect public and private key here
  8. Replace admin email with your email ID. And don’t forget to save all the details in local file for further use
  9. Press Ctrl + x  then Y and hit enter to save the changes
  10. To start the installation process
     sudo bash install.sh
  11. It will take little bit time to install and once the installation is done you can start using Magento by calling the IP Address in your browser
  12. To get admin URL, Navigate to
    • cd /var/www/html/youripaddress/webroot
    • php bin/magento info:adminuri
  13. It will display the admin URL like below. Add the path with your IP like ipaddress/admin_1wgrah
    Admin Panel URI: /admin_1wgrah 
  14. Enter the admin login name and admin login pass which you can find in configuration file

In some cases, we may get the error like site broken or doesn’t load properly and if you are the one facing the issue, Execute the below commands.

  • Navigate into Magneto root directory
    • cd /var/www/html/youripaddress/webroot
  • Execute the below commands one by one
    • chown -R :www-data .
    • find . -type d -exec chmod 770 {} \;
    • find . -type f -exec chmod 660 {} \;
    • chmod u+x bin/magento

That’s all, Now we have successfully installed Magento 2 with NGINX, MYSQL in Ubuntu. If you are facing any issues or having doubts, Feel free to comment it below and we are very happy to give our best on it.

 

 

 

Leave a Reply

Your email address will not be published.