{"id":2323,"date":"2025-08-26T17:50:48","date_gmt":"2022-06-16T08:58:05","guid":{"rendered":""},"modified":"2025-02-02T00:46:18","modified_gmt":"2025-02-01T23:46:18","slug":"how-to-install-laravel-php-framework-with-apache-2-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-laravel-php-framework-with-apache-2-on-ubuntu-22-04\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Laravel PHP Framework with Apache 2 on Ubuntu 22.04"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<h1>\u00a0<\/h1>\n<p>Laravel is a powerful and popular PHP framework used for building modern web applications. In this tutorial, we will guide you through the installation of the Laravel PHP Framework with Apache 2 on Ubuntu 22.04.<\/p>\n<h2>Step 1: Update the System<\/h2>\n<p>Start by updating your system to ensure all packages are up-to-date. Run the following command:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade<\/code><\/pre>\n<h2>Step 2: Install Apache 2<\/h2>\n<p>Apache 2 is a widely used web server. Install it with the following command:<\/p>\n<pre><code>sudo apt install apache2<\/code><\/pre>\n<p>After installation, start and enable Apache:<\/p>\n<pre><code>sudo systemctl start apache2<\/code><\/pre>\n<pre><code>sudo systemctl enable apache2<\/code><\/pre>\n<h2>Step 3: Install PHP and Required Extensions<\/h2>\n<p>Laravel requires PHP and several extensions. Install them using the following command:<\/p>\n<pre><code>sudo apt install php libapache2-mod-php php-mbstring php-xml php-bcmath php-json php-zip<\/code><\/pre>\n<h2>Step 4: Install Composer<\/h2>\n<p>Composer is a dependency manager for PHP and is required for Laravel. Download and install Composer with the following commands:<\/p>\n<pre><code>curl -sS https:\/\/getcomposer.org\/installer | php<\/code><\/pre>\n<pre><code>sudo mv composer.phar \/usr\/local\/bin\/composer<\/code><\/pre>\n<h2>Step 5: Install Laravel<\/h2>\n<p>Now, navigate to your Apache root directory and install Laravel using Composer:<\/p>\n<pre><code>cd \/var\/www\/html<\/code><\/pre>\n<pre><code>sudo composer create-project --prefer-dist laravel\/laravel mylaravelapp<\/code><\/pre>\n<p>Set the correct permissions:<\/p>\n<pre><code>sudo chown -R www-data:www-data \/var\/www\/html\/mylaravelapp<\/code><\/pre>\n<h2>Step 6: Configure Apache for Laravel<\/h2>\n<p>Next, configure Apache to serve your Laravel application. Create a new virtual host file:<\/p>\n<pre><code>sudo nano \/etc\/apache2\/sites-available\/laravel.conf<\/code><\/pre>\n<p>Add the following content to the file:<\/p>\n<pre><code>\r\n    &lt;VirtualHost *:80&gt;\r\n        ServerAdmin admin@example.com\r\n        DocumentRoot \/var\/www\/html\/mylaravelapp\/public\r\n        ServerName your_domain.com\r\n\r\n        &lt;Directory \/var\/www\/html\/mylaravelapp\/public&gt;\r\n            AllowOverride All\r\n        &lt;\/Directory&gt;\r\n\r\n        ErrorLog ${APACHE_LOG_DIR}\/error.log\r\n        CustomLog ${APACHE_LOG_DIR}\/access.log combined\r\n    &lt;\/VirtualHost&gt;\r\n    <\/code><\/pre>\n<p>Enable the new configuration and restart Apache:<\/p>\n<pre><code>sudo a2ensite laravel.conf<\/code><\/pre>\n<pre><code>sudo systemctl restart apache2<\/code><\/pre>\n<h2>Step 7: Test the Laravel Application<\/h2>\n<p>To check if everything is set up correctly, open your browser and navigate to <code>http:\/\/your_domain.com<\/code>. You should see the default Laravel welcome page.<\/p>\n<h2>Conclusion<\/h2>\n<p>Congratulations! You have successfully installed the Laravel PHP framework with Apache 2 on Ubuntu 22.04.<\/p>\n<p>If you&#8217;re looking for a reliable hosting solution to deploy your Laravel application, consider using  services. A <strong>Windows VPS<\/strong> offers great flexibility and performance for hosting both PHP and other server applications. With , you can enjoy secure and scalable hosting solutions.<\/p>\n<p>Whether you&#8217;re looking for a <strong>Windows VPSVirtual Private Server Hosting<\/strong> or need a <strong>Virtual Dedicated Server<\/strong>, you can find affordable and powerful options through <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a>. Many businesses across Europe, including Italy and the UK, rely on <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Microsoft SQL VPS Windows<\/a> and <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">UK VPS Windows<\/a> to handle their hosting needs, whether it&#8217;s for development, testing, or production environments.<\/p>\n<p>Explore more hosting options at , where you can find tailored hosting services, including <strong>Windows VPS<\/strong> for high-performance requirements and <strong>Windows VPSVirtual Private Servers<\/strong> for scalable hosting needs.<\/p>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 Laravel is a powerful and popular PHP framework used for building modern web applications. In this tutorial, we will guide you through the installation of the\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2323"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2323\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}