This post will describe how you can set up a Magento website with a Nginx web server on an Alibaba Cloud ECS instance installed with Ubuntu 14.04.
Magento is an open-source platform specially designed to make flexible e-commerce websites. It's written in PHP and offers business tools which fast tracks the development process and increase productivity. It's one of the commonly used tools to build an e-commerce websites and has witnessed incredible user adoption until now. We will be working on the Magento version 22.214.171.124 in this tutorial.
You'll need to Install the LAMP (Linux, Apache, MySQL, and PHP) stack: To proceed further, you primarily need to have the LAMP (Linux, Apache, MySQL, and PHP) stack ready on your Alibaba Cloud ECS instance. We will be using ApsaraDB for RDS as a database in this blog. Use this quick guide for steps for installation
Let's go through the steps of deploying Magento on an Alibaba Cloud ECS instance. At this point, we have an Alibaba Cloud ECS server with Apache web server and PHP installed. Now, we are going to create a database and user for Magento, which will be used as a datastore for the website.
1. Click on the instance name or manage in the ApsaraDB for RDS console to navigate to the configuration page for that particular RDS instance.
2. Navigate to Account Management to create a Database user. Click on Create Account to create a new user account for ApsaraDB for RDS.
3. Fill all the required details like Database account name, Authorized Database (we have not created any database yet so leave it blank) and Password. Click OK to create the account.
4. A database account has been set up for Magento
5. Next, we are going to create a database. Navigate to Database Management from the sidebar menu and click on Create Database. Fill in all the details including the database account that is authorized to access this database and Click OK.
6. A database has been created.
7. Next, we need to create a Database endpoint. ApsaraDB for RDS allows us to create the Intranet and/or the Internet endpoint. To apply for either endpoint, we need to create a whitelist for the database. The Whitelist is a list of host IP or network IP that can access the database. To create a whitelist, navigate to Security Control from the sidebar menu and click on Add Whitelist Group. A pop-up would appear, fill in the group name and whitelist IP addresses and click OK.
8. As soon as a whitelist is created, the Intranet endpoint will be provided to the RDS. Navigate to the Basic information tab from the sidebar menu to get information about this endpoint for the RDS instance.
To proceed further, we primarily need to create a non-root user with sudo privileges.
Login to the command line interface for ECS instance that we had launched earlier in step 1 using the following command:
Create a new user using the following command:
Now, you will be further asked to enter user credentials and other details.
To give sudo access to your user, add this user to sudoers using the following command:
sudo adduser magento_demo sudo
Next, download the actual Magento files from the project's website.
To download Magento, you need to sign-up on Magento official website and download zip or tar file.
Once you have downloaded Magento, you can transfer its tar or zip file to the Alibaba Cloud server.
Use the following command to extract the files required for rebuilding the Magento directory:
# tar -xvf magento-1.9.2.tar.gz
This command creates a directory called "magento" in your current directory.
Copy content of this directory into "
/var/www/html". To increase security, change the ownership of files using the following command:
#sudo chown -R www-data:www-data /var/www/html
Now, let's download a few more packages that are needed. Magento requires a couple of PHP modules which can be directly accessed from Ubuntu's default repositories after we update our local package index:
# sudo apt-get install libcurl3 php5-curl php5-gd php5-mcrypt
After downloading Magento, we need to configure Apache web server to serve Magento application. Create a virtual host for Apache to handle Magento traffic.
# vim /etc/apache2/sites-enabled/magento.conf <VirtualHost *:80> ServerName magento_demo.com ServerAlias www.magento_demo.com DocumentRoot /var/www/html <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All </Directory> </VirtualHost>
And that's it. Disable the default virtual host configuration of Apache web server and restart it using the following command:
# sudo service apache2 restart
All configuration of Magento is done using web UI. Open your browser and navigate to your server's domain name or public IP address:
You will see the Magento installation wizard, where you can view the open software license agreement to use Magento. Click on the checkbox to agree to the terms and conditions and click on Continue:
Choose the type of relational database. We have been using MySQL for this video. Enter the required details such as host, database name, username and password used while creating the database and user for Magento.
Now, fill up the web access options including the base URL of your Magento site and admin dashboard path. You can also configure other settings as per your requirements.
Also, choose the storage type for session management and click on continue.
Now, you have to enter the localization details including your locale language, time zone and default currency of your country. Click on continue once done.
Here, create an admin account by entering your personal and login information. You can also provide the encryption key to encrypt passwords and credit card details. Also, Magento automatically generates an encryption key in case it is not provided by you. Click on continue to proceed further
That's it. You are ready to leverage Magento to make your e-commerce store. Make a not of your encryption key for future use. Click on Go to Backend to access admin console or Go to Frontend to see your online store.
This is how Magento Admin Console looks like. You can perform all administration operations like add or delete products, make catalogs, etc. from this console.
Your e-commerce website is up and running on Alibaba Cloud ECS (Ubuntu 14.04).
Some related Alibaba Cloud Security and Monitoring Products are Alibaba Cloud WAF and CloudMonitor. To increase the reliability and security of your e-commerce website in the production environment, you can utilize other security and monitoring products offered by Alibaba Cloud.
You can also take backup by taking snapshots of our running database to eliminate database failure.
Alibaba Cloud WAF can be used to provide protection against web-based attacks, including SQL injections, XSS, Malicious BOT, command execution vulnerabilities, and other common web attacks. WAF filters out many malicious access attempts and alleviates the performance impact of HTTP/HTTPS flood attacks on servers.
Alibaba Cloud CloudMonitor can be used to provide in-depth insights into your cloud deployments. CloudMonitor provides advanced analytics on critical metrics such as CPU utilization, latency and also lets you customize metrics specific to business requirements.
Alibaba Clouder - December 18, 2017
Alibaba Clouder - October 21, 2019
Alibaba Clouder - April 12, 2019
Alibaba Clouder - September 2, 2020
Alibaba Clouder - April 16, 2018
Alibaba Clouder - August 16, 2019
An online computing service that offers elastic and secure virtual cloud servers to cater all your cloud hosting needs.Learn More
An on-demand database hosting service for MySQL, SQL Server and PostgreSQL with automated monitoring, backup and disaster recovery capabilitiesLearn More
A cloud firewall service utilizing big data capabilities to protect against web-based attacksLearn More
More Posts by Alibaba Clouder