{"id":7339,"date":"2020-11-18T06:55:01","date_gmt":"2020-11-18T06:55:01","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=7339"},"modified":"2020-11-18T14:51:28","modified_gmt":"2020-11-18T14:51:28","slug":"laravel-and-apache-2-setup","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2020\/11\/18\/laravel-and-apache-2-setup\/","title":{"rendered":"Laravel and Apache 2 Setup"},"content":{"rendered":"<ul>\n<li>LARAVEL APACHE SETUP<br \/>\nCREATE A CONF<\/p>\n<pre class=\"lang:default decode:true\">sudo cp \/etc\/apache2\/sites-available\/000-default.conf \/etc\/apache2\/sites-available\/abilik-laravel.test.conf<\/pre>\n<p>EDIT<\/p>\n<pre class=\"lang:default decode:true\">sudo gedit \/etc\/apache2\/sites-available\/abilik-laravel.test.conf<\/pre>\n<p>CONTENT<\/p>\n<pre class=\"lang:default decode:true \">&lt;VirtualHost abilik-laravel.test:80&gt;\r\n\tServerName www.abilik-laravel.test\r\n\tDocumentRoot \"\/home\/teddy\/Documents\/works\/abilik-laravel\"\r\n\tDirectoryIndex index.php\r\n\t&lt;Directory \"\/home\/teddy\/Documents\/works\/abilik-laravel\"&gt;\r\n\t    AllowOverride All\r\n\t    Allow from All\r\n\t    Require all granted\r\n\t&lt;\/Directory&gt;\r\n\tErrorLog \/var\/log\/apache2\/abilik-laravel.error.log\r\n\tCustomLog \/var\/log\/apache2\/abilik-laravel.access.log combined\r\n&lt;\/VirtualHost&gt;<\/pre>\n<p>ENABLE THE VIRTUALHOST<\/p>\n<pre class=\"lang:default decode:true\">sudo a2ensite abilik-laravel.test.conf\r\n\r\nsudo a2enmod rewrite<\/pre>\n<p>&nbsp;<\/p>\n<p>RELOAD APACHE2<\/p>\n<pre class=\"lang:default decode:true\">sudo systemctl reload apache2<\/pre>\n<p>&nbsp;<\/p>\n<p>CREATE THE HOST<\/p>\n<pre class=\"lang:default decode:true\">sudo gedit \/etc\/hosts<\/pre>\n<pre class=\"lang:default decode:true\">127.0.0.1 abilik-laravel.test<\/pre>\n<p>SET THE FILE PERMISSIONS &amp; RELOAD APACHE2<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy:~\/Documents\/works$ sudo chmod -R 777 abilik-laravel\/\r\nteddy@teddy:~\/Documents\/works$ sudo systemctl reload apache2<\/pre>\n<p>MODIFY .env FILE<\/p>\n<pre class=\"lang:default decode:true \">DB_DATABASE=abilik_laravel\r\nDB_USERNAME=root\r\nDB_PASSWORD=teddy<\/pre>\n<p>CHECK \/home\/teddy\/Documents\/works\/abilik-laravel\/app\/Providers\/AppServiceProvider.php<br \/>\nTO DISABLE HTTPS ON MY LOCAL<\/p>\n<pre class=\"lang:default decode:true \">    public function boot()\r\n    {\r\n        \/\/\\URL::forceScheme('https');\r\n    }<\/pre>\n<p>MODIFY .htaccess (DEFAULT FROM \/public\/ DIR)<\/p>\n<pre class=\"lang:default decode:true\">AddType  application\/x-httpd-php         .php\r\nAddType  application\/x-httpd-php-source  .phps\r\n&lt;IfModule mod_rewrite.c&gt;\r\n    &lt;IfModule mod_negotiation.c&gt;\r\n        Options -MultiViews -Indexes\r\n    &lt;\/IfModule&gt;\r\n\r\n    RewriteEngine On\r\n\r\n    # Handle Authorization Header\r\n    RewriteCond %{HTTP:Authorization} .\r\n    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\r\n\r\n    # Redirect Trailing Slashes If Not A Folder...\r\n    RewriteCond %{REQUEST_FILENAME} !-d\r\n    RewriteCond %{REQUEST_URI} (.+)\/$\r\n    RewriteRule ^ %1 [L,R=301]\r\n\r\n    # Handle Front Controller...\r\n    RewriteCond %{REQUEST_FILENAME} !-d\r\n    RewriteCond %{REQUEST_FILENAME} !-f\r\n    RewriteRule ^ index.php [L]\r\n&lt;\/IfModule&gt;\r\n\r\n&lt;IfModule mod_headers.c&gt;\r\nHeader append Cache-Control \"public\"\r\n&lt;\/IfModule&gt;\r\n\r\n## EXPIRES CACHING ##\r\n&lt;IfModule mod_expires.c&gt;\r\nExpiresActive On\r\nExpiresByType image\/jpg \"access plus 1 year\"\r\nExpiresByType image\/jpeg \"access plus 1 year\"\r\nExpiresByType image\/gif \"access plus 1 year\"\r\nExpiresByType image\/png \"access plus 1 year\"\r\nExpiresByType text\/css \"access plus 1 month\"\r\nExpiresByType application\/pdf \"access plus 1 month\"\r\nExpiresByType text\/x-javascript \"access plus 20 minutes\"\r\nExpiresByType application\/x-shockwave-flash \"access plus 1 month\"\r\nExpiresByType application\/x-javascript \"access plus 20 minutes\"\r\nExpiresByType text\/javascript \"access plus 15 minutes\"\r\nExpiresByType application\/javascript \"access plus 1 month\"\r\nExpiresByType application\/json \"access plus 20 minutes\"\r\nExpiresByType image\/x-icon \"access plus 1 year\"\r\nExpiresDefault \"access plus 2 days\"\r\n&lt;\/IfModule&gt;\r\n## EXPIRES CACHING ##<\/pre>\n<p>&nbsp;<\/p>\n<p>CLEAR THE PREVIOUS CACHE &amp; ROUTE ON THE WEB ROOT (FOR EXAMPLE teddy@teddy:~\/Documents\/works\/abilik-laravel$ php artisan route:clear)<\/p>\n<pre class=\"lang:default decode:true \">php artisan route:clear\r\n\r\nphp artisan config:clear\r\n\r\nphp artisan cache:clear<\/pre>\n<pre class=\"lang:default decode:true \">teddy@teddy:~\/Documents\/works\/abilik-laravel$ php artisan help -V\r\nPHP Warning:  Module 'curl' already loaded in Unknown on line 0\r\nLaravel Framework 6.5.1\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>OPEN: http:\/\/abilik-laravel.test\/<br \/>\nhttp:\/\/abilik-laravel.test\/oc-admin<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>LARAVEL APACHE SETUP CREATE A CONF sudo cp \/etc\/apache2\/sites-available\/000-default.conf \/etc\/apache2\/sites-available\/abilik-laravel.test.conf EDIT sudo gedit \/etc\/apache2\/sites-available\/abilik-laravel.test.conf CONTENT &lt;VirtualHost abilik-laravel.test:80&gt; ServerName www.abilik-laravel.test DocumentRoot &#8220;\/home\/teddy\/Documents\/works\/abilik-laravel&#8221; DirectoryIndex index.php &lt;Directory &#8220;\/home\/teddy\/Documents\/works\/abilik-laravel&#8221;&gt; AllowOverride All Allow from All Require all granted &lt;\/Directory&gt; ErrorLog \/var\/log\/apache2\/abilik-laravel.error.log CustomLog \/var\/log\/apache2\/abilik-laravel.access.log combined &lt;\/VirtualHost&gt; ENABLE THE VIRTUALHOST sudo a2ensite abilik-laravel.test.conf sudo a2enmod rewrite &nbsp; RELOAD APACHE2 sudo systemctl reload &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2020\/11\/18\/laravel-and-apache-2-setup\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Laravel and Apache 2 Setup&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"class_list":["post-7339","post","type-post","status-publish","format-standard","hentry","category-laravel-2"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/7339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=7339"}],"version-history":[{"count":2,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/7339\/revisions"}],"predecessor-version":[{"id":7347,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/7339\/revisions\/7347"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=7339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=7339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=7339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}