Upload VM on Azure

In this article

To create a Resource Group

To create a virtual network

To upload the VHD file to Azure

To create a new Azure virtual machine

Magento base URL updates

This article explains the process of uploading Magento VM on Azure.

To create a Resource Group

  1. In the Azure portal, search for resource groups.
  2. Click Add to create a new resource group.
  3. Complete the required details, and click Review - Create.

To create a virtual network

  1. In the Azure portal, search for Virtual Network.
  2. Click Add, and select the resource group.
  3. Enter the virtual network name in Name, and select the default Region.
  4. Click Next.
  5. In the IP Address tab, add the required IP addresses.
  6. Click Next.
  7. In the Security tab, select the default security.
  8. Click Review - Create.
  9. Click Subnets to assign IP to the virtual machines.

To upload the VHD file to Azure

  1. Download the Magento VM VHD file from here: Magento Azure VM VHD
  2. In the Azure portal, select Storage Accounts.
  3. Select the storage account to which you want to upload the .vhd file.
  4. If you do not have a storage account, click Add to create one.
    Note: The selected storage location dictates where subsequent images can be created and deployed.
  5. In BLOB SERVICE, select Containers.
  6. Select the container to which you want to upload the .vhd file.
  7. If you do not have a storage container, click Add Container to create one.
  8. Click Upload, and select the .vhd file to upload.
  9. Set the Blob type to Page Blob.

Note: This process may take a long time depending on your network connection and the location of your Azure storage account.

To create a new Azure virtual machine

  1. In Settings - Disks, click Create managed disk.
  2. Select the Resource group.
  3. Enter the disk name in the Disk name field.
  4. Select the Region.
  5. Select Source type.
  6. Select Source blob. Browse to the uploaded .vhd file and select the file.
  7. Select the OS type.
  8. Select the required disk size.
  9. Click Review - Create.
  10. In Settings - Disks, click Create VM.
  11. Select the Resource group.
  12. Enter the name of the virtual machine in the Virtual machine name field.
  13. In the Image text box, browse and select ubuntu 18.04 LTS.
  14. Select the required virtual machine size.
  15. In the Authentication type field, select Password.
  16. Verify the network subnets, and click Review - Create.

Magento base URL updates

  1. You have to SSH into Magento, proceed to sudo nano /etc/nginx/sites-available/ls-magento.lsretail.com.conf, and remove the SSL part :

    Copy
    server {
    listen 443 ssl;
    server_name ls-magento.lsretail.com;
    #sl_certificate /etc/nginx/ssl/nginx.crt;
    #ssl_certificate_key /etc/nginx/ssl/nginx.key;
    ssl_certificate /etc/letsencrypt/live/ls-magento.lsretail.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/ls-magento.lsretail.com/privkey.pem; # managed by Certbot
    location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-Port 443;
    proxy_set_header Host $host;
    }
  1. Restart Nginx service: sudo service nginx restart.
  2. Navigate to cd/var/www/html/ls-magento.lsretail.com/, and run these commands:
    Copy
    find . -type f -exec chmod 644 {} \;// 644 permission for files
    find . -type d -exec chmod 755 {} \;// 755 permission for folders
    find . -type d -exec chmod 755 {} \;// 755 permission for folders
    chmod 644 ./app/etc/*.xml
    chown -R :<web server group>
    chmod u+x bin/magento
    php bin/magento setup:store-config:set --base-url="http://yourAzureIPAddress/"
    php bin/magento setup:store-config:set --base-url-secure="https://yourAzureIPAddress/"
    php bin/magento admin:user:create --admin-user=lsecommerce --admin-password=@Admin0101 --admin-email=hi@test.com --admin-firstname=lsecommerce --admin-lastname=lsecommerce
    php bin/magento c:f