{"id":12824,"date":"2020-04-14T13:13:20","date_gmt":"2020-04-14T13:13:20","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=12824"},"modified":"2021-11-12T05:56:01","modified_gmt":"2021-11-12T05:56:01","slug":"how-to-deploy-laravel-application-on-aws-ec2","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-deploy-laravel-application-on-aws-ec2\/","title":{"rendered":"How to deploy Laravel application on AWS EC2"},"content":{"rendered":"\n<p>In the first step you should login to your putty using <strong>user name<\/strong> and <strong>password<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"425\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/open-putty-and-login-using-username-and-password.jpg\" alt=\"\" class=\"wp-image-12827\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/open-putty-and-login-using-username-and-password.jpg 683w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/open-putty-and-login-using-username-and-password-300x187.jpg 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure>\n\n\n\n<p>After Login you should run command <em><span style=\"text-decoration: underline;\"><strong>sudo -s<\/strong><\/span><\/em> for root access<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"424\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/run-sudos-for-root-user.jpg\" alt=\"\" class=\"wp-image-12828\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/run-sudos-for-root-user.jpg 683w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/run-sudos-for-root-user-300x186.jpg 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure>\n\n\n\n<p>then you should change your directory to Xampp htdocs location so for that you should type command <br><em><strong><span style=\"text-decoration: underline;\">cd<\/span> <span style=\"text-decoration: underline;\">\/opt\/lampp\/htdocs<\/span><\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"685\" height=\"424\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/change-location-htdocs-directory.jpg\" alt=\"\" class=\"wp-image-12829\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/change-location-htdocs-directory.jpg 685w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/change-location-htdocs-directory-300x186.jpg 300w\" sizes=\"auto, (max-width: 685px) 100vw, 685px\" \/><\/figure>\n\n\n\n<p>Now you should clone your project directory from bitbucket using clone command <br><em>git clone git@bitbucket.org:<strong>repo<\/strong>\/<strong>reponame.git<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"656\" height=\"361\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/bitbucket-repo-clone-command.jpg\" alt=\"\" class=\"wp-image-12830\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/bitbucket-repo-clone-command.jpg 656w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/bitbucket-repo-clone-command-300x165.jpg 300w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/figure>\n\n\n\n<p>after cloning repo you should jump into that folder using <em><span style=\"text-decoration: underline;\">cd repoName<\/span><\/em> and run some below commands for installtion of node_modules and vendor file and also setup of .env file.<\/p>\n\n\n\n<p>first of all you should copy .env file using <em><span style=\"text-decoration: underline;\">cp .env.example .env<\/span><\/em><\/p>\n\n\n\n<p>run below some commands for some setup<br><em><span style=\"text-decoration: underline;\"><strong>npm install<\/strong><\/span><\/em> for node_modules<br><em><span style=\"text-decoration: underline;\"><strong>composer install<\/strong><\/span><\/em> for vendor files<br><em><span style=\"text-decoration: underline;\"><strong>npm run dev<\/strong> <\/span><\/em>  ( combines all your Vue components and other JavaScript files into a browser-friendly combined file )<\/p>\n\n\n\n<p>if all the above command runs successfully then a create a virtual host in Xampp. for this you should change the dir to <em><span style=\"text-decoration: underline;\">cd \/opt\/lampp\/etc<\/span><\/em> and open <em><span style=\"text-decoration: underline;\"><strong>httpd.conf<\/strong><\/span><\/em> file to uncomment below line and save file <\/p>\n\n\n\n<p>#Virtual hosts<br>#Include conf\/extra\/httpd-vhosts.conf<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"363\" height=\"53\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/uncomment-this-line.jpg\" alt=\"\" class=\"wp-image-12831\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/uncomment-this-line.jpg 363w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/uncomment-this-line-300x44.jpg 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/uncomment-this-line-355x53.jpg 355w\" sizes=\"auto, (max-width: 363px) 100vw, 363px\" \/><\/figure>\n\n\n\n<p>Now again change directory and went into <strong>cd \/opt\/lampp\/etc\/extra<\/strong> and below line to <em>httpd-vhosts.conf<\/em> file<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/cmschandan\/455781b513e829e3510d49366c71b736.js\"><\/script>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"378\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/extra-folder-open-httpd-vhosts-conf-file.jpg\" alt=\"\" class=\"wp-image-12833\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/extra-folder-open-httpd-vhosts-conf-file.jpg 683w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/04\/extra-folder-open-httpd-vhosts-conf-file-300x166.jpg 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure>\n\n\n\n<p>After following above steps you can easily run any laravel project in AWS EC2 Machine. and you should also know that xampp is already installed in your machine if you want to learn the xampp installtion then follow below urls.<\/p>\n\n\n\n<p>Resource 1 : <a rel=\"noreferrer noopener\" href=\"https:\/\/medium.com\/@RahulShukla754\/amazon-ec2-setup-with-ubuntu-and-xampp-installation-37c3c0eeb51d\" target=\"_blank\">Link<\/a><br>Resource 2 :  <a href=\"https:\/\/dmsbilas.wordpress.com\/2019\/03\/12\/how-to-install-xampp-in-amazon-aws-ubuntu-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link<\/a><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_49026\"><iframe loading=\"lazy\"  id=\"_ytid_50372\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_49026\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>In the first step you should login to your putty using user name and password. After Login you should run command sudo -s for root access then you should change&#8230; <\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5633],"tags":[162,751,5203,4602,399,6046,5356],"class_list":["post-12824","post","type-post","status-publish","format-standard","hentry","category-aws","tag-aws","tag-installation-guide","tag-laravel","tag-nodejs","tag-server","tag-virtualhost","tag-xampp"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/12824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=12824"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/12824\/revisions"}],"predecessor-version":[{"id":24873,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/12824\/revisions\/24873"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=12824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=12824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=12824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}