{"componentChunkName":"component---gatsby-theme-teklog-src-templates-post-tsx","path":"/how-to-prepare-ubuntu-18-04-vps-to-run-symfony-5-application-on-apache-2-4-with-mod_php","result":{"data":{"site":{"siteMetadata":{"siteUrl":"https://blog.tekmi.nl","author":{"name":"Teklog","avatar":"/img/tekmi-icon.svg"}}},"blogPost":{"frontmatter":{"title":"How to prepare Ubuntu 18.04 VPS to run Symfony 5 application on Apache 2.4 with mod_php","slug":"how-to-prepare-ubuntu-18-04-vps-to-run-symfony-5-application-on-apache-2-4-with-mod_php","series":null,"date":"2020-02-25","datePretty":"25 February, 2020","coverImage":{"childImageSharp":{"fixed":{"base64":"data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAANABQDASIAAhEBAxEB/8QAFwAAAwEAAAAAAAAAAAAAAAAAAAIFA//EABUBAQEAAAAAAAAAAAAAAAAAAAID/9oADAMBAAIQAxAAAAFVoZuUopCP/8QAGhABAQACAwAAAAAAAAAAAAAAAQIAEQMQFP/aAAgBAQABBQKND53K4qlAnF11/8QAFxEBAAMAAAAAAAAAAAAAAAAAABESUf/aAAgBAwEBPwGNVf/EABURAQEAAAAAAAAAAAAAAAAAAAAR/9oACAECAQE/Aar/xAAbEAACAQUAAAAAAAAAAAAAAAAAARECEBIhMf/aAAgBAQAGPwJrFOTVSIg5f//EABwQAAICAgMAAAAAAAAAAAAAAAABESExYUFRcf/aAAgBAQABPyFaAkKeBzJMd6MlNoQUnpEombP/2gAMAwEAAgADAAAAEBv/AP/EABYRAQEBAAAAAAAAAAAAAAAAAAABIf/aAAgBAwEBPxDcKf/EABcRAQADAAAAAAAAAAAAAAAAAAABITH/2gAIAQIBAT8Q3SH/xAAbEAEAAwEAAwAAAAAAAAAAAAABABEhQTHh8P/aAAgBAQABPxAw+HXTWq/MXYm7IlDvojJLsGxJVlPUbGLYhVjyJ2NZ/9k=","width":1000,"height":625,"src":"/static/cd473edc05771174398bc4072d07ed48/a7715/CloudingFeaturedImage.jpg","srcSet":"/static/cd473edc05771174398bc4072d07ed48/a7715/CloudingFeaturedImage.jpg 1x"}}},"author":"Adam","authorAvatar":{"childImageSharp":{"fixed":{"base64":"data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAUABQDASIAAhEBAxEB/8QAGAABAQEBAQAAAAAAAAAAAAAAAAMFAgT/xAAVAQEBAAAAAAAAAAAAAAAAAAABAv/aAAwDAQACEAMQAAAB6t5LRWgqZwrlmiE//8QAHRAAAgIBBQAAAAAAAAAAAAAAAgMAAREEECEiM//aAAgBAQABBQJ77CJIy2cPXS8niHEeQFeP/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAHBAAAQQDAQAAAAAAAAAAAAAAAQACEFERIjFx/9oACAEBAAY/AgG9K3xAdSNT6Y//xAAcEAACAwADAQAAAAAAAAAAAAAAAREhQRAxUWH/2gAIAQEAAT8hQxfd4Ku1Y0QWqJYSQnRcE0rT6Gif/9oADAMBAAIAAwAAABCUF0P/xAAYEQEBAAMAAAAAAAAAAAAAAAABABARQf/aAAgBAwEBPxABFxy3f//EABcRAQEBAQAAAAAAAAAAAAAAAAABETH/2gAIAQIBAT8QYnWR/8QAHBABAQEBAAIDAAAAAAAAAAAAAREAITFBUXGR/9oACAEBAAE/EO4YeNBr9KKOP5r017BL2JnAYCW9nrXgB8p849uFlfXDIhqM7v/Z","width":40,"height":40,"src":"/static/6c8382e6e16f3f6564acde1a72bbc51f/0cce2/authorAvatar.jpg","srcSet":"/static/6c8382e6e16f3f6564acde1a72bbc51f/0cce2/authorAvatar.jpg 1x,\n/static/6c8382e6e16f3f6564acde1a72bbc51f/56ed0/authorAvatar.jpg 1.5x,\n/static/6c8382e6e16f3f6564acde1a72bbc51f/2b9ee/authorAvatar.jpg 2x"}}}},"timeToRead":12,"excerpt":"Introduction In case you never heard about Symfony, it is a PHP framework to create websites and web applications. It comes with over 50 reusable…","html":"<h2 id=\"introduction\" style=\"position:relative;\"><a href=\"#introduction\" aria-label=\"introduction permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction</h2>\n<p>In case you never heard about Symfony, it is a PHP framework to create websites and web applications.</p>\n<p>It comes with over 50 reusable components that power many well-known PHP applications, such as Drupal, phpBB, and eZ Publish.</p>\n<p><a href=\"https://symfony.com/releases\">The Symfony release cycle</a> is pretty predictable and follows a time-based model. Major versions come out every two years, while minor versions every six months. At the time of writing, the latest stable release is Symfony 5.</p>\n<p>However, having a good framework is not enough, you still need to host your project somewhere. Symfony encourages using <em>SymfonyCloud</em>, which is their <em>Platform-as-a-Service</em> offer. This may save you some headaches, but at the same time, you may lose control of your infrastructure.</p>\n<p>In this blog post, I would like to walk you through another approach, where we will deploy our Symfony 5 application onto the servers of the Infrastructure-as-a-Service provider of our choice.</p>\n<h2 id=\"choosing-iaas-provider\" style=\"position:relative;\"><a href=\"#choosing-iaas-provider\" aria-label=\"choosing iaas provider permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Choosing IaaS provider</h2>\n<p>There are plenty of them, such as AWS EC2, Google Compute Engine, or Digital Ocean. They all have a strong market position and offer a wide spectrum of services. I've built a few projects based on their infra, but this time I wanted to try out something else.</p>\n<p>I was looking for a smaller IaaS company that was established somewhere in Europe. Plus, I wanted to spin off the latest Ubuntu LTS server in a Data Center located in Europe. To my surprise, I've found an emerging IaaS player from Spain, which met all those requirements.</p>\n<p>To give you a brief summary, <a href=\"https://clouding.io/en/\">Clouding.io</a> provides cloud VPS servers based on Intel Xeon cores, 80 Gbps Cisco network and KVM OpenStack virtualization system. Their offer looks stable enough to me and includes 3x Replica, Tier 4 Datacenter quality level, and Anti-DDOS protection.</p>\n<p>Additionally, I could tinker with their platform at no cost, because they give out a 5 EUR credit for free to everyone upon <a href=\"https://portal.clouding.io/register?lang=en\">registration</a>.</p>\n<h2 id=\"prerequisites\" style=\"position:relative;\"><a href=\"#prerequisites\" aria-label=\"prerequisites permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Prerequisites</h2>\n<p>If you want to follow along, here is the list of requirements:</p>\n<ul>\n<li>Clouding Account (or any other IaaS platform of your choice)</li>\n<li>Operating system with SSH client installed (needed to SSH into the VPS)</li>\n</ul>\n<p>Moreover, the following things are nice to have:</p>\n<ul>\n<li>Base knowledge of Linux, Ubuntu</li>\n<li>Base knowledge of Web Servers, Apache</li>\n<li>Base knowledge of PHP, Symfony</li>\n</ul>\n<p>Without further ado, let's start with the technical part of this tutorial.</p>\n<h2 id=\"spinning-off-ubuntu-1804-server-on-clouding\" style=\"position:relative;\"><a href=\"#spinning-off-ubuntu-1804-server-on-clouding\" aria-label=\"spinning off ubuntu 1804 server on clouding permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Spinning off Ubuntu 18.04 Server on Clouding</h2>\n<p>Feel free to <a href=\"#installing-php-composer-and-other-symfony-needed-packages\">skip</a> this part if you use another IaaS platform.</p>\n<p>After signing up for the Clouding account, you can log into their <a href=\"https://portal.clouding.io/\">panel</a> with your credentials. Click on the <em>Servers</em> navigation item and then select <em>My Servers</em> tab, which should redirect you to the <a href=\"https://portal.clouding.io/dsb/vmm/vmlist\">Servers List</a> page. </p>\n<p>Press the \"<em>Click here to create your first server</em>\" or \"<em>Plus</em>\" button to start the <a href=\"https://portal.clouding.io/dsb/vmm/create\">Creation Wizard screen</a>. In there,</p>\n<ul>\n<li>pick up a name for your VPS (I named mine 'SymfonyMachine')</li>\n<li>select the disc source (I chose Linux with Ubuntu 18.04 version)</li>\n<li>select the server configuration (I chose the minimal configuration of 2 GB of RAM per vCore, 0.5 vCores, and 5 GB Disk SSD)</li>\n<li>enable backups if needed (I left it disabled)</li>\n<li>configure access by selecting default SSH key or creating a new one (I picked up a default SSH key since I won't use it in this tutorial)</li>\n<li>configure firewall by choosing the default profile or creating a new one (I chose the default firewall profile)</li>\n</ul>\n<p>If you prefer visual, here is the aforementioned configuration in the form of an image.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/fab0eb555e00151b9d1b9daba52dc7a3/db9ce/SymfonyMachineCreationWizard.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 135.20000000000002%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAbCAYAAAB836/YAAAACXBIWXMAABYlAAAWJQFJUiTwAAADoElEQVRIx5VV227cVBT1U8VH9KUVQvAr/YoinuEzoKXwAagqPCIekBASqBJXpVSVogq1aRO1SSaZtB6Pxx57fL8ee7HX8Zypc2mAIy2f+z5rX229e2eGG9/4uHbbwQdfzvCezK/ftnHtlo33v5jh6qe2xvXPX+PKxwmsD1tYHzWncbPFO5+kuPrZa1i/vEjw846P+89DPJrmeDgt8cdhofHnpMDvBwI9z3F/t5azStDipzGetnrvt4McFtAhCT3E4RIcA71ArcdY9+rMuMfbmtXKmbgG5pn0VY+maZHlJfKiQt0qGRdI0kyPi7JCmuUo6wat6jUa1aERIXre9bA6+QRBgFCwWq302Pd9lGWJy1rf9xeuWZ1SsG0b8/kcdV1DybxpGnRdtzlkLp8d84znB7BdX+61g8pcjKJIY8zKXH4blNwrixxRXmPfieDOHaRpCoubRVHozVL6U8JweTOadJ1CnucDw77vEIYrON4KYRSjqSv0a3U7UUOJ0WmKqqq0OQjO2agRhbatODLLBoH6olCJSrko3lplJV6JcNuPEIg6tQiiKhRIJEmie2Pjc04xRn758gWc6TEO5PFH397F9le38DhsMZ1MsLW1pc+QxWw2G9h3A3MyJGtjf8vYy10skCcxDqMKPzx8gh//+huPnQSB7+Hk5ESz4iUyHOzW6TUjsFjbX6vMBdpBtQ2SSuGV7E1TwE+rDQsjkODapSpTFb5MW8VxhDxNzoXPRY2PkAix8TJfssUujEMKZLbE8Ru1DBgNRrhhd6FAiQosVhmqtTomtmgTMmdvwoStllzno0qE8Ow5p/Czv3+Aw8MJlsslFuIcwvO8DZjbTM04SVFLESAzMjX2NQ7aCNzZeYbdvT0kcSxBHmoGY8SyvnBdhKsITUdVy38X+Oz5rq40rlx0HEczMiDj6XQqjwW6XF2UKRsb8hMKC9ddaNW4wRd1GJlwWqcba+XY84Oz+lORoL1M25EJ2XFMb9MZFM6ec4JOYj8ubyZr+DB7LZB2olpUmeqy5wGyGjPgWVMvDWtGRxAscXx0pGNZC6QQ5ijtxHgkE4LOoJf5IM0xDh9TvlL5RWRlDW8Z6l+EzhR6lqoa+5lGlhTEPapOViZVTXGYBwkmixTHboykqAeBdLl5fWxsE7BkctYZqhv+kImUuJS1sIqgmnrw8n/J2/G6Ge4tGnz3NMeDoxzf7yTw0vZN+fo/6NYSt08KfL0d49f9DPekd+IW/wB3vQ8cBqoaQAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/fab0eb555e00151b9d1b9daba52dc7a3/70216/SymfonyMachineCreationWizard.webp 250w,\n/static/fab0eb555e00151b9d1b9daba52dc7a3/61bdd/SymfonyMachineCreationWizard.webp 500w,\n/static/fab0eb555e00151b9d1b9daba52dc7a3/d0dac/SymfonyMachineCreationWizard.webp 1000w,\n/static/fab0eb555e00151b9d1b9daba52dc7a3/697bd/SymfonyMachineCreationWizard.webp 1020w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/fab0eb555e00151b9d1b9daba52dc7a3/41b2e/SymfonyMachineCreationWizard.png 250w,\n/static/fab0eb555e00151b9d1b9daba52dc7a3/36a81/SymfonyMachineCreationWizard.png 500w,\n/static/fab0eb555e00151b9d1b9daba52dc7a3/ea415/SymfonyMachineCreationWizard.png 1000w,\n/static/fab0eb555e00151b9d1b9daba52dc7a3/db9ce/SymfonyMachineCreationWizard.png 1020w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/fab0eb555e00151b9d1b9daba52dc7a3/ea415/SymfonyMachineCreationWizard.png\"\n          alt=\"SymfonyMachineCreationWizard\"\n          title=\"SymfonyMachineCreationWizard\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p>Once ready, please press the <em>Submit</em> button at the bottom of the page. This will start the process of creating a new VPS and you will be redirected back to the Servers List page, as shown below.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/3662300c8bdf8af1dd2b0062c21a875b/2faef/VPSList-1024x400.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 39.2%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsSAAALEgHS3X78AAAA5klEQVQoz41RW27DMAzz/S/S0+xzV2gxDEPjR/x2OFOLsqLougYQQtsiKdPm43KG9w6vfNu2/Vvm/BXgYkFvDeu6otaKNnGMUXDvHSkl2XsmNO2kjMsDsW5CJIn/McZDrGTusX7XHTZ15Dpg9stATP645j2mgQoOivaK09sV75cEs4awj4tDlNPwyjlnWZNMfCteSz1iILHvBubTRlxDQS7tcGZ21losyyKYjc65+XgepRTxTzWhtCJnTaL5icRYH7A4DzebSdJJKH6bHTHF1LRPAZbmeUz4LDcVEsIUVkE10tJz9n8DOYp2fZmB2KoAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/3662300c8bdf8af1dd2b0062c21a875b/70216/VPSList-1024x400.webp 250w,\n/static/3662300c8bdf8af1dd2b0062c21a875b/61bdd/VPSList-1024x400.webp 500w,\n/static/3662300c8bdf8af1dd2b0062c21a875b/d0dac/VPSList-1024x400.webp 1000w,\n/static/3662300c8bdf8af1dd2b0062c21a875b/701c5/VPSList-1024x400.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/3662300c8bdf8af1dd2b0062c21a875b/41b2e/VPSList-1024x400.png 250w,\n/static/3662300c8bdf8af1dd2b0062c21a875b/36a81/VPSList-1024x400.png 500w,\n/static/3662300c8bdf8af1dd2b0062c21a875b/ea415/VPSList-1024x400.png 1000w,\n/static/3662300c8bdf8af1dd2b0062c21a875b/2faef/VPSList-1024x400.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/3662300c8bdf8af1dd2b0062c21a875b/ea415/VPSList-1024x400.png\"\n          alt=\"VPSList 1024x400\"\n          title=\"VPSList 1024x400\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p>From there, click on your VPS name to go to the VPS Detail Page. Your VPS will be still spinning up, but you can already familiarize yourself with the page. The most important part is the Public IP and the Password, which is by default hidden. Those details will be also sent to you by email, once your server reaches an Active status.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/43c494e910465bb48fbde11c5c9cc61b/2faef/SymfonyMachineDetailPage-1024x958.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 93.60000000000001%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAACXBIWXMAAAsSAAALEgHS3X78AAACLElEQVQ4y41USY7UMBT1HbkAS9ZwAK7BBokdi97QK06AxBKJC9Ciqyrz7DiDncd/TjmkCqq7Lb14zPvTs1We5zgdD6iqEvu2LMvWX4+fgurNgLjsUOsB8zxDa41xHLfxNE1+3Pe97/9Hsm9qtgva0cHMC6x1AgvnnMet8R5cH4YBxhhvXDmxoIXQutUaDxBhzJ/oGRHWr9PQtq2krELXdVCtmXEoByTtjHFaQ6NFWtPdGjJD52Ej6bH06oyQjouQ86LAr4cHZFIceiM2/UbVVjCjuSjQuVwb6BXBFlKgsizD8XjcEr6SAqVUPUkSH6ZsoJFIcm1R9BZZZ2VuxeMeZVn6/G1VLoocVVlsnvwlrBDHiaTB+vmHbzlefz7izd0Jrz494uP3Am7sJRXa/7MRttpIUSxYbU+4rOFwrdQTarMS3v2o8PZLhPdfE7y7j3D/s0bfNaia5kKjKm96/E4b6GH2oe2tBQNOFIDF/QMjUYxVfSls3Gie+Ewe0nC9b0UuVhTgdo4oVvd0Ogki3x8OB6+rfRg8HEURHmWP+1EU/2MgnFOsEu8zK0W9EUH1RBBzI7niuUJkRnAeUNe1167XYdASBR2wJw5yIkkcR0iTWPoVjIiSY885iRU/BL251UhI76IkQ5xKfyaspCD0kCliTydUcPua4Bp8gfrJCRYMHJ+vaACjYXo8oZFNLvAnevrcE/VUU2magveZboe8veQhvfnAzuImn6/nQn4p/gD7vMgWyCaAFwAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/43c494e910465bb48fbde11c5c9cc61b/70216/SymfonyMachineDetailPage-1024x958.webp 250w,\n/static/43c494e910465bb48fbde11c5c9cc61b/61bdd/SymfonyMachineDetailPage-1024x958.webp 500w,\n/static/43c494e910465bb48fbde11c5c9cc61b/d0dac/SymfonyMachineDetailPage-1024x958.webp 1000w,\n/static/43c494e910465bb48fbde11c5c9cc61b/701c5/SymfonyMachineDetailPage-1024x958.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/43c494e910465bb48fbde11c5c9cc61b/41b2e/SymfonyMachineDetailPage-1024x958.png 250w,\n/static/43c494e910465bb48fbde11c5c9cc61b/36a81/SymfonyMachineDetailPage-1024x958.png 500w,\n/static/43c494e910465bb48fbde11c5c9cc61b/ea415/SymfonyMachineDetailPage-1024x958.png 1000w,\n/static/43c494e910465bb48fbde11c5c9cc61b/2faef/SymfonyMachineDetailPage-1024x958.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/43c494e910465bb48fbde11c5c9cc61b/ea415/SymfonyMachineDetailPage-1024x958.png\"\n          alt=\"SymfonyMachineDetailPage 1024x958\"\n          title=\"SymfonyMachineDetailPage 1024x958\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p>At this point, we have all the needed details to SSH into newly created VPS. To do so, open the terminal on your host machine and type the following. (If you use Windows, you may need to install PuTTY first, a free SSH client)</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">ssh</span> root@46.183.113.213</code></pre></div>\n<p>Replace <em>46.183.113.213</em> with the IP of your VPS. As you see, I'm using my VPS root password here, but I strongly encourage you to utilize your SSH keys.</p>\n<p>If you see something of that kind,</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">The authenticity of <span class=\"token function\">host</span> <span class=\"token string\">'46.183.113.213 (46.183.113.213)'</span> can't be established.\nECDSA key fingerprint is SHA256:DUl2RM1UUohS569dJEG/F9/Eco+fkU3VB/9Pg8/JGYA.\nAre you sure you want to <span class=\"token builtin class-name\">continue</span> connecting <span class=\"token punctuation\">(</span>yes/no<span class=\"token punctuation\">)</span>?</code></pre></div>\n<p>please choose yes and you will never be prompted for this again on this computer. After that, use your VPS root password and you should be in your VPS console. To verify if you have the right Ubuntu system, type the following</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">lsb_release -a\n\n<span class=\"token comment\"># result</span>\nNo LSB modules are available.\nDistributor ID: Ubuntu\nDescription: Ubuntu <span class=\"token number\">18.04</span>.4 LTS\nRelease: <span class=\"token number\">18.04</span>\nCodename: bionic</code></pre></div>\n<p>The final steps are to update the Ubuntu list of package sources with command</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> update</code></pre></div>\n<p>and then upgrade all installed packaged to their newest versions by running</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> upgrade -y</code></pre></div>\n<p>This can take up to a few minutes and you may be prompted to give an answer during some installation steps.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/853fd9c7ffd287b195aca43f38bbd95b/2faef/AptUpgradeLibssl-1024x175.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 17.200000000000003%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAAAsSAAALEgHS3X78AAAAoElEQVQI12WLuQ7CMBAF8/+iQ8pVUiAFEEd8xF47juIEAhT80sN2REUxmpF2X8a2GqxWYGWgWmlDt8G3QoLlAiJnAQ5WiHTjddhUOnltBdoNuG46ZJJJdC5gJARxdDa2AFmB3tuEjZ56uIAdDYbZ4f6e4Z8jppeHX0YsnwfOhwsydSSQJGhOUFxDi9BMQTUnGGn/IGHSX/SPuO3JYV82+ALYsrsoB69aSgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/853fd9c7ffd287b195aca43f38bbd95b/70216/AptUpgradeLibssl-1024x175.webp 250w,\n/static/853fd9c7ffd287b195aca43f38bbd95b/61bdd/AptUpgradeLibssl-1024x175.webp 500w,\n/static/853fd9c7ffd287b195aca43f38bbd95b/d0dac/AptUpgradeLibssl-1024x175.webp 1000w,\n/static/853fd9c7ffd287b195aca43f38bbd95b/701c5/AptUpgradeLibssl-1024x175.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/853fd9c7ffd287b195aca43f38bbd95b/41b2e/AptUpgradeLibssl-1024x175.png 250w,\n/static/853fd9c7ffd287b195aca43f38bbd95b/36a81/AptUpgradeLibssl-1024x175.png 500w,\n/static/853fd9c7ffd287b195aca43f38bbd95b/ea415/AptUpgradeLibssl-1024x175.png 1000w,\n/static/853fd9c7ffd287b195aca43f38bbd95b/2faef/AptUpgradeLibssl-1024x175.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/853fd9c7ffd287b195aca43f38bbd95b/ea415/AptUpgradeLibssl-1024x175.png\"\n          alt=\"AptUpgradeLibssl 1024x175\"\n          title=\"AptUpgradeLibssl 1024x175\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/f626e978f05c3c62e3ab2139286983cd/2faef/AptUpgradeGrubPc-1024x300.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 29.2%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsSAAALEgHS3X78AAABNUlEQVQY023Oy07CQBQG4L6YWxa+hgk8hneLRBPlWnXhWiIUSkuhdNpOYW60iDHxeX6HIkSNiy//nJlzTsZwLB9O04dd9zBojuG0JkW6jwSuNYPf9jGxpvAeZvCeIrg6R+0p3E6wN+rouhng+dCGEUuCOI1A0rAQzQlIEiAY90GmQ8Shi4R4oNEYPPHBeQyecY1tLRnEioOmFJelOgyVSwgmIYXGJZRaYk4Ievc1dG+v8HJzUeTrXRVeowbq2JAqA2dczwmdAlJK0DBFtdSCwRUHmzOwxdamMUko+sMRur2BZu9zEsZYbJYUvfyb/qEQSGZ0u3D1mSFbL5G9Zz/o+k0hXyuoXGi8OOf6fuNXr55dfeRgnMEsNWAcV85xVjZxWr76Q99VTJzs6sp/Pbs37cjE9YGFL7TbbG9oW/2EAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/f626e978f05c3c62e3ab2139286983cd/70216/AptUpgradeGrubPc-1024x300.webp 250w,\n/static/f626e978f05c3c62e3ab2139286983cd/61bdd/AptUpgradeGrubPc-1024x300.webp 500w,\n/static/f626e978f05c3c62e3ab2139286983cd/d0dac/AptUpgradeGrubPc-1024x300.webp 1000w,\n/static/f626e978f05c3c62e3ab2139286983cd/701c5/AptUpgradeGrubPc-1024x300.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/f626e978f05c3c62e3ab2139286983cd/41b2e/AptUpgradeGrubPc-1024x300.png 250w,\n/static/f626e978f05c3c62e3ab2139286983cd/36a81/AptUpgradeGrubPc-1024x300.png 500w,\n/static/f626e978f05c3c62e3ab2139286983cd/ea415/AptUpgradeGrubPc-1024x300.png 1000w,\n/static/f626e978f05c3c62e3ab2139286983cd/2faef/AptUpgradeGrubPc-1024x300.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/f626e978f05c3c62e3ab2139286983cd/ea415/AptUpgradeGrubPc-1024x300.png\"\n          alt=\"AptUpgradeGrubPc 1024x300\"\n          title=\"AptUpgradeGrubPc 1024x300\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/71736e8df1ebf44b06352fe7dd27fc87/2faef/AptUpgradeSsh-1024x298.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 29.2%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsSAAALEgHS3X78AAABNUlEQVQY053MTUsCURTG8flyfYwwWhap0K51FAlGiRGhaWKBlpqO2ujY+FL3zlvqjBlBn+bfdVxE0KrFj+fcy3OOphef0HMGzasOrdxqVvIG3ZJF+7pHr2DQL/bo35gY5VH03yn06SpRFk06+R7GnUl5s4U2cixGkyHWxFKeGa5yZGK2axjNCoNunbHZVnTEoI2cmNi+je3JNV8iHYG/dMls5dG8mYdju7jOmuf5iPGYRjZN7eyEavqI+9NjHs5T6JkUVvUWV3Vsaas9J2ILGz/wuIgV0aQvEK+KWJNSMlYHa80W1cYjlXqDSq0RpW70mahDUvz0Iy8Cd+aQjRXQ3j8XBPOQMPwtmM8Jldl0ypvvEwbqHQQswr+6AR9fSy63S2i7yR2SiSSJROL/4kni+3scbBzyDRyTa/S+63RnAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/71736e8df1ebf44b06352fe7dd27fc87/70216/AptUpgradeSsh-1024x298.webp 250w,\n/static/71736e8df1ebf44b06352fe7dd27fc87/61bdd/AptUpgradeSsh-1024x298.webp 500w,\n/static/71736e8df1ebf44b06352fe7dd27fc87/d0dac/AptUpgradeSsh-1024x298.webp 1000w,\n/static/71736e8df1ebf44b06352fe7dd27fc87/701c5/AptUpgradeSsh-1024x298.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/71736e8df1ebf44b06352fe7dd27fc87/41b2e/AptUpgradeSsh-1024x298.png 250w,\n/static/71736e8df1ebf44b06352fe7dd27fc87/36a81/AptUpgradeSsh-1024x298.png 500w,\n/static/71736e8df1ebf44b06352fe7dd27fc87/ea415/AptUpgradeSsh-1024x298.png 1000w,\n/static/71736e8df1ebf44b06352fe7dd27fc87/2faef/AptUpgradeSsh-1024x298.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/71736e8df1ebf44b06352fe7dd27fc87/ea415/AptUpgradeSsh-1024x298.png\"\n          alt=\"AptUpgradeSsh 1024x298\"\n          title=\"AptUpgradeSsh 1024x298\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p>In case you also see</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">Configuration <span class=\"token function\">file</span> <span class=\"token string\">'/etc/cloud/cloud.cfg'</span>\n <span class=\"token operator\">==</span><span class=\"token operator\">></span> Modified <span class=\"token punctuation\">(</span>by you or by a script<span class=\"token punctuation\">)</span> since installation.\n <span class=\"token operator\">==</span><span class=\"token operator\">></span> Package distributor has shipped an updated version.\n   What would you like to <span class=\"token keyword\">do</span> about it ?  Your options are:\n    Y or I  <span class=\"token builtin class-name\">:</span> <span class=\"token function\">install</span> the package maintainer's version\n    N or O  <span class=\"token builtin class-name\">:</span> keep your currently-installed version\n      D     <span class=\"token builtin class-name\">:</span> show the differences between the versions\n      Z     <span class=\"token builtin class-name\">:</span> start a shell to examine the situation\n The default action is to keep your current version.\n*** cloud.cfg <span class=\"token punctuation\">(</span>Y/I/N/O/D/Z<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">[</span>default<span class=\"token operator\">=</span>N<span class=\"token punctuation\">]</span> ?</code></pre></div>\n<p>Hit <strong>Enter</strong>, choosing the default option to keep your currently-installed version.</p>\n<p>After all of that, let's quickly recap what we have until now and then move on to the next step.</p>\n<ul>\n<li>We have one VPS running on the Clouding platform with Ubuntu 18.04 LTS version</li>\n<li>We obtained the public IP, hostname, and root password of our VPS</li>\n<li>We have updated and upgraded all Ubuntu 18.04 packages</li>\n</ul>\n<h2 id=\"installing-php-composer-and-other-symfony-needed-packages\" style=\"position:relative;\"><a href=\"#installing-php-composer-and-other-symfony-needed-packages\" aria-label=\"installing php composer and other symfony needed packages permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Installing PHP, Composer and other Symfony needed packages</h2>\n<p>Like every Linux system, Ubuntu 18.04 comes with some preinstalled libraries. In the case of PHP, it comes with <em>php7.2</em> package and we can check it easily by running</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> show php\n\n<span class=\"token comment\"># result</span>\nPackage: php\nVersion: <span class=\"token number\">1</span>:7.2+60ubuntu1\nOrigin: Ubuntu\nDepends: php7.2\n<span class=\"token punctuation\">..</span>.\nAPT-Sources: http://ubuntu.repos.clouding.io bionic/main amd64 Packages\nDescription:\n<span class=\"token punctuation\">..</span>.\nThis package is a dependency package, <span class=\"token function\">which</span> depends on Ubuntu's default\nPHP version <span class=\"token punctuation\">(</span>currently <span class=\"token number\">7.2</span><span class=\"token punctuation\">)</span>.</code></pre></div>\n<p>With that, we can drill down to get more information about the dependant <em>php7.2</em> package.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> show php7.2 -a\n\n<span class=\"token comment\"># result</span>\nPackage: php7.2\nOrigin: Ubuntu\nVersion: <span class=\"token number\">7.2</span>.24-0ubuntu0.18.04.3\n<span class=\"token punctuation\">..</span>.\n\nPackage: php7.2\nOrigin: Ubuntu\nVersion: <span class=\"token number\">7.2</span>.3-1ubuntu1\n<span class=\"token punctuation\">..</span>.</code></pre></div>\n<p>As we see, there are actually two available versions of <em>php7.2</em> package. We can compare them with the <a href=\"https://symfony.com/doc/current/setup.html#technical-requirements\">Symfony technical requirements</a> and may conclude we are good to go since the minimum required PHP version is 7.2.5.</p>\n<p>I will choose another route though. We all like the newest language features, so let's install the latest stable PHP package. If you explore the <a href=\"https://www.php.net/ChangeLog-7.php\">PHP Changelog</a>, PHP 7.4.0 has been released in November 2019. At the time of writing, the latest version is 7.4.2, so let's try to get this one.</p>\n<p>To achieve it, we will use <em>deb</em> repositories kindly provided by <a href=\"https://deb.sury.org/\">Sury.org</a>. For Ubuntu, they maintain the <a href=\"https://launchpad.net/~ondrej/+archive/ubuntu/php/\">PHP Ubuntu Personal Package Archives</a>, which we will install on our VPS.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> <span class=\"token function\">install</span> software-properties-common -y\nadd-apt-repository ppa:ondrej/php -y\n<span class=\"token function\">apt</span> update</code></pre></div>\n<p>Once apt finishes updating the package list, we can check again our <em>php</em> package with <code class=\"language-text\">apt show php -a</code> </p>\n<p>It should have two versions now, one coming from Sury and one from Ubuntu.</p>\n<ul>\n<li>Version  <em>2:7.4+72+ubuntu18.04.1+deb.sury.org+1</em> which depends on <em>php7.4</em> package</li>\n<li>Old Version <em>1:7.2+60ubuntu1</em> which depends on <em>php7.2</em> package</li>\n</ul>\n<p>If we examine the <em>php7.4</em> package with the command <code class=\"language-text\">apt show php7.4</code>, we see that version 7.4.2 is available. Let's proceed with the installation.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> <span class=\"token function\">install</span> php7.4</code></pre></div>\n<p>It will ask if we want to install the recommended packages. Since <em>php7.4</em> depends on <em>libapache2-mod-php7.4</em>, which in turn recommends <em>apache2</em> package, then we will have PHP and Apache with mod_php up and running.</p>\n<hr>\n<p>As a side note, you could actually install any other PHP version greater or equal to 7.0.</p>\n<hr>\n<p>After that, we must install a few additional PHP libraries, because both Composer and Symfony need them.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">apt</span> <span class=\"token function\">install</span> php7.4-xml php7.4-zip -y</code></pre></div>\n<p>At this point, we can check which versions of PHP and Apache were installed on our VPS with:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">php -v\n\n<span class=\"token comment\"># result</span>\nPHP <span class=\"token number\">7.4</span>.2 <span class=\"token punctuation\">(</span>cli<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>built: Feb  <span class=\"token number\">5</span> <span class=\"token number\">2020</span> <span class=\"token number\">16</span>:50:38<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span> NTS <span class=\"token punctuation\">)</span>\nCopyright <span class=\"token punctuation\">(</span>c<span class=\"token punctuation\">)</span> The PHP Group\nZend Engine v3.4.0, Copyright <span class=\"token punctuation\">(</span>c<span class=\"token punctuation\">)</span> Zend Technologies\n    with Zend OPcache v7.4.2, Copyright <span class=\"token punctuation\">(</span>c<span class=\"token punctuation\">)</span>, by Zend Technologies</code></pre></div>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">apache2 -v\n\n<span class=\"token comment\"># result</span>\nServer version: Apache/2.4.29 <span class=\"token punctuation\">(</span>Ubuntu<span class=\"token punctuation\">)</span>\nServer built: <span class=\"token number\">2019</span>-09-16T12:58:48</code></pre></div>\n<p>As a matter of fact, if you visit your Public IP address now, you should see a default Apache2 page. We will change it after we install the Symfony application. But for now, let's install a Composer package manager, by following its <a href=\"https://getcomposer.org/download/\">official guide</a>.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">php -r <span class=\"token string\">\"copy('https://getcomposer.org/installer', 'composer-setup.php');\"</span>\nphp composer-setup.php --install-dir<span class=\"token operator\">=</span>/usr/local/bin --filename<span class=\"token operator\">=</span>composer\n\n<span class=\"token comment\"># You can also verify the SHA-384 and remove the installer, as described in the guide</span></code></pre></div>\n<p>This was the last step of this chapter, so let's review what we have achieved so far</p>\n<ul>\n<li>we installed the PHP 7.4.2 version utilizing Sury Ubuntu PPA</li>\n<li>Apache 2.4 with mod_php has been installed automatically for us</li>\n<li>we downloaded and installed Composer package manager</li>\n</ul>\n<p>It looks like we have all prerequisites to boot up the first Symfony 5 applications, so let's get into the last two chapters together.</p>\n<h2 id=\"installing-symfony-5-application-to-verify-the-provisioned-vps-configuration\" style=\"position:relative;\"><a href=\"#installing-symfony-5-application-to-verify-the-provisioned-vps-configuration\" aria-label=\"installing symfony 5 application to verify the provisioned vps configuration permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Installing Symfony 5 application to verify the provisioned VPS configuration</h2>\n<p><a href=\"https://symfony.com/doc/current/setup.html#creating-symfony-applications\">Symfony Setup Guide</a> recommends two ways of creating a new application:</p>\n<ul>\n<li>with the use of Symfony binary</li>\n<li>with the use of composer</li>\n</ul>\n<p>It also provides two types of Symfony applications</p>\n<ul>\n<li>a traditional web application</li>\n<li>microservice, console app or API</li>\n</ul>\n<p>In this tutorial, I will use the Composer to scaffold a traditional web application</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token builtin class-name\">cd</span> /var/www/\ncomposer create-project symfony/website-skeleton symfony5app\n<span class=\"token builtin class-name\">cd</span> symfony5app\n\n<span class=\"token comment\"># this will output Symfony version and other information</span>\n./bin/console about</code></pre></div>\n<p>Let's also scaffold a Symfony Controller to see how various routes are working together.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">/bin/console make:controller TestController</code></pre></div>\n<p>Having all of that, let's configure the Apache2 webserver to run our Symfony 5 application.</p>\n<h2 id=\"apache2-configuration-for-symfony-5-using-mod_php\" style=\"position:relative;\"><a href=\"#apache2-configuration-for-symfony-5-using-mod_php\" aria-label=\"apache2 configuration for symfony 5 using mod_php permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Apache2 configuration for Symfony 5 using mod_php</h2>\n<p><a href=\"https://symfony.com/doc/current/setup/web_server_configuration.html#apache-with-mod-php-php-cgi\">Symfony Web Server Guide</a> presents a plethora of ways to configure the Symfony applications on the Web Server. In this tutorial, I will choose the easiest route and set up Apache2 with mod_php.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token builtin class-name\">cd</span> /etc/apache2/sites-available/\n\n<span class=\"token function\">cat</span> <span class=\"token operator\">></span> 001-symfony5app.conf <span class=\"token operator\">&lt;&lt;</span><span class=\"token string\">EOF\n&lt;VirtualHost *:80>\n   ServerName symfony5app\n\n    DocumentRoot /var/www/symfony5app/public\n    DirectoryIndex /index.php\n\n    &lt;Directory /var/www/symfony5app/public>\n        AllowOverride None\n        Require all granted\n\n        FallbackResource /index.php\n    &lt;/Directory>\n\n    &lt;Directory /var/www/symfony5app/public/bundles>\n        FallbackResource disabled\n    &lt;/Directory>\n\n    ErrorLog /var/log/apache2/symfony5app_error.log\n    CustomLog /var/log/apache2/symfony5app_access.log combined\n&lt;/VirtualHost>\nEOF</span></code></pre></div>\n<p>Having that, we must disable the default site configuration and enable ours.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">a2dissite 000-default.conf\na2ensite 001-symfony5app.conf</code></pre></div>\n<p>And lastly, reload the Apache2 webserver to put our changes into action.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">systemctl reload apache2</code></pre></div>\n<p>If you visit your Public IP now, you should see the Symfony 5 welcome page, as shown below.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/578f529c42461d7c206b2df5188e7448/2faef/SymfonyDefaultRoute-1024x562.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 54.800000000000004%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsSAAALEgHS3X78AAACyElEQVQozzWQWU9TYRCGzy8xMUFkkcpWulpaEFBokSJQ0aqIC3FBRFlCwGjEqFxpjAsiIMZdQSNChYKaeOetVy5RQxCL7FCEFtHHOYd4Mfnme+edJzOj9Plf0D/Qg/9VD6/e+OgffM7z3oe89D/D19+Jz99Fb98TLV76n0rIX/Tevk4GX/dK+BiQXv9gDypLiYpbRVziahIMEaRY1mJKjWFDehz2rHjSNyeStjkBt8chYddyVXNkJWDbqMNsj5WeKBINa9AJI1pYSnxyBHpzFCZbrIB0mnljThJZuXpy8k0C0fG46xYDr7vJcCaIZtRqGeJxbBKw9JhSYzVGvD4CJckYidEWswITQ6Yzmew8A64CE3keK3nbrJxsLKfxwgnckquaq8BMtttApiuZtP9QGSjJuBYlxRKNxbGyYoYKE2NuoZn87TbcxRb2Hc6juqGUipod7C7LZovHxFapqZ5st1EbQN3KmhZHijUaxWxfhz1zBZYjhi0yQYE3laJddgFsouliLVdbznG5uVF7D1UWSd1GodeuTaueINOp1xgqS9FbImXCGJlQR4ZLbrRVL2uaKd7j4MDRXJouVdPcfoErLY1caz1HZZ2Xot2puLdbcBYY5J7qLddjTY+V08mEO0pc7NybS1m5h8raEmoa9mkr1p85QMPZMgEUc6zOw/H6YqoavJw6f4jT549QVV/C0WovBys87D9ciLfUhdO9AWVicpSZ2QkWFuYIheZZXAxquar9HBtmJPCN4ZEvBEaH+Dn+nfGJH0zPjBOcn2YuOMXs3KR4xxkT/eu3Dyjh5UV+Ly/wKzxPeDnEl6H3fA985i+/Wf4TAnlD4SDBX5OiLWnan79LTM0EGA58kjws/YuartaVt52PuPfgLh993bx7+oSW1uu03LxGx+02OjokbrfT2naDm6Kr+X+trf3Gik/+tyTuP7hDZ9dj/gE+qB2o8u4awgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/578f529c42461d7c206b2df5188e7448/70216/SymfonyDefaultRoute-1024x562.webp 250w,\n/static/578f529c42461d7c206b2df5188e7448/61bdd/SymfonyDefaultRoute-1024x562.webp 500w,\n/static/578f529c42461d7c206b2df5188e7448/d0dac/SymfonyDefaultRoute-1024x562.webp 1000w,\n/static/578f529c42461d7c206b2df5188e7448/701c5/SymfonyDefaultRoute-1024x562.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/578f529c42461d7c206b2df5188e7448/41b2e/SymfonyDefaultRoute-1024x562.png 250w,\n/static/578f529c42461d7c206b2df5188e7448/36a81/SymfonyDefaultRoute-1024x562.png 500w,\n/static/578f529c42461d7c206b2df5188e7448/ea415/SymfonyDefaultRoute-1024x562.png 1000w,\n/static/578f529c42461d7c206b2df5188e7448/2faef/SymfonyDefaultRoute-1024x562.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/578f529c42461d7c206b2df5188e7448/ea415/SymfonyDefaultRoute-1024x562.png\"\n          alt=\"SymfonyDefaultRoute 1024x562\"\n          title=\"SymfonyDefaultRoute 1024x562\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p>And if you open the <em>/test</em> URL, you should see the scaffolded Test Controller in action.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; box-shadow: 5px 5px 9px 0px rgba(0,0,0,0.5); max-width: 1000px;\"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/68dbd551d3ad53a3a2ee5b2436eeb643/2faef/SymfonyTestRoute-1024x562.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 54.800000000000004%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsSAAALEgHS3X78AAAA5ElEQVQoz9WSwU6EMBCG+/4PAqx18UKM0YvxoolHU7kqhaAbdPGiwLb9pBhWYgy7Gi/+zTdt0pk/00lF0zSMGGPIMk2apiil+v0WdaO4vL+ieqswnWGa/x2CrdwQ67pGa90bZ+R5wUP5yPq1pt202I3FOcechE8Y8erajqLIh07LrOp5YqXXlHcVz6sXrLVMa74i5i6ddb2BG0xGI/+SHxt+DuFjwW6j/Tr8Bf/A0A/bGLsdvLGTc/8v92WsEfyxxMnFKYuF5Oz4iOvzhAN5SLxcIqUkiiLCMJzF5wRBQBzHJEnCO+eLT67IYejHAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n        <source\n          srcset=\"/static/68dbd551d3ad53a3a2ee5b2436eeb643/70216/SymfonyTestRoute-1024x562.webp 250w,\n/static/68dbd551d3ad53a3a2ee5b2436eeb643/61bdd/SymfonyTestRoute-1024x562.webp 500w,\n/static/68dbd551d3ad53a3a2ee5b2436eeb643/d0dac/SymfonyTestRoute-1024x562.webp 1000w,\n/static/68dbd551d3ad53a3a2ee5b2436eeb643/701c5/SymfonyTestRoute-1024x562.webp 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/68dbd551d3ad53a3a2ee5b2436eeb643/41b2e/SymfonyTestRoute-1024x562.png 250w,\n/static/68dbd551d3ad53a3a2ee5b2436eeb643/36a81/SymfonyTestRoute-1024x562.png 500w,\n/static/68dbd551d3ad53a3a2ee5b2436eeb643/ea415/SymfonyTestRoute-1024x562.png 1000w,\n/static/68dbd551d3ad53a3a2ee5b2436eeb643/2faef/SymfonyTestRoute-1024x562.png 1024w\"\n          sizes=\"(max-width: 1000px) 100vw, 1000px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          src=\"/static/68dbd551d3ad53a3a2ee5b2436eeb643/ea415/SymfonyTestRoute-1024x562.png\"\n          alt=\"SymfonyTestRoute 1024x562\"\n          title=\"SymfonyTestRoute 1024x562\"\n          loading=\"lazy\"\n          style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        />\n      </picture>\n  </a>\n    </span></p>\n<p>As a side note, you've probably noticed that the Web Debug Toolbar is visible on both screenshots. If you deploy Symfony application to production, you should follow specific guidelines to make it secure and performant. This tutorial was not meant for that, but if this interests you, I can write another blog post soon.</p>\n<h2 id=\"summary\" style=\"position:relative;\"><a href=\"#summary\" aria-label=\"summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Summary</h2>\n<p>We have achieved a lot together. We started with spinning off Ubuntu 18.04 VPS on the Clouding platform. Then we SSH into our VPS and installed the latest PHP 7.4 and Apache 2.4 libraries. After that, we took care of Composer package manager. And in the end, we scaffolded the most basic Symfony 5 application and saw it running in the browser.</p>\n<p>However, this only touched the tip of the iceberg. There are a lot of options and solutions out there, basically at every step of this process. We didn't discuss here the best practices for deployment, security, or server provisioning. We didn't do anything related to Infrastructure-as-a-Code or dwelt into containerized solutions.</p>\n<p>I hope I've helped you broaden your understanding of server provisioning and whet your appetite for more complex configuration. I tried to include several links to good practices and industry standards, where you can explore more on your own.</p>\n<p>I'm considering to write more tutorials covering the following topics, so please let me know if any of them interests you.</p>\n<ul>\n<li>preparing and deploying Symfony 5 application to production</li>\n<li>learning how to write Ansible playbooks to provision any VPS</li>\n<li>exploring how to use Docker and Docker Composer to spin off a few containers on one VPS</li>\n</ul>\n<h2 id=\"attribution\" style=\"position:relative;\"><a href=\"#attribution\" aria-label=\"attribution permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Attribution</h2>\n<p><a href=\"https://unsplash.com/photos/80sv993lUKI\">Cover Photo</a> by Alex Machado</p>"}},"pageContext":{"postId":"4e109e37-3afb-59a1-97cd-8902475efd06","slug":"how-to-prepare-ubuntu-18-04-vps-to-run-symfony-5-application-on-apache-2-4-with-mod_php"}}}