How To Configure Laravel PHP Framework on CentOS/RHEL 6x
What is Laravel PHP Framework ?
-- Laravel is a free, open-source PHP Web Framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.
Installation Step :
Step: 1. Set Host Name :
# hostname laravel.oit.com
# vi /etc/sysconfig/network
HOSTNAME=laravel.oit.com
-- Save & Quit (:wq)
Step: 2. Bind Host File :
# vi /etc/hosts
10.100.97.38 laravel.domain.com laravel
-- Save & Quit (:wq)
Step: 3. Stop Firewall & Disable Selinux :
# service iptables stop
# chkconfig iptables off
# vi /etc/sysconfig/selinux
SELINUX=disabled
-- Save & Quit (:wq)
Step: 4. Install NTP Server For Time Synchronization :
# yum -y install ntp ntpdate
# service ntpd restart
# chkconfig ntpd on
# ntpdate pool.ntp.org
Step: 5. Reboot the System :
# init 6
Step: 6. Install EPEL & Remi Repository :
# yum -y install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Step: 7. Install Apache Server :
# yum -y install --enablerepo=remi,epel httpd httpd-devel
Step: 8. Remove MySQL 5.1 & Install MySQL 5.6 :
# yum -y remove mysql mysql-*
# rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# yum -y install mysql mysql-server
Step: 9. Start MySQL Service & Set Root Password :
# service mysqld restart
# chkconfig mysqld on
# mysql_secure_installation
Step: 10. Install PHP 5.6 :
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum -y install php56w php56w-common php56w-cli php56w-devel php56w-gd \
php56w-mysql php56w-mcrypt php56w-mbstring php56w-imap php56w-snmp \
php56w-xml php56w-xmlrpc php56w-ldap php56w-pdo php56w-json php56w-dom \
wget unzip curl git openssl
Step: 11. Install Composer :
Note: Composer is required for installing Laravel Dependencies.
# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer
Step: 12. Install Laravel Framework :
Note: To download latest version of Laravel, Use below command to clone master repo of laravel
from github.
# cd /var/www/html
# git clone https://github.com/laravel/laravel.git
# cd /var/www/html/laravel
# composer install
# chown -Rf apache.apache /var/www/html/laravel
# chmod -Rf 755 /var/www/html/laravel
Step: 13. Set Encryption Key :
-- Now set the 32 bit long random number encryption key, which used by the Illuminate
encryption service.
# cd /var/www/html/laravel
# mv .env.example .env
# chown -Rf apache.apache /var/www/html/laravel
# php artisan key:generate
[OUTPUT]
Application key [base64:lNOx1cxl0JWAWX56/Ql6o7/mcw7AVairy1Uqs2XplFo=] set successfully.
-- Update the above Generated Application key into the config/app.php configuration file.
Also make sure that cipher is set properly.
# vi /var/www/html/laravel/config/app.php
'key' => env('APP_KEY', 'base64:IZ+g3FU+OF1nO4j/4y4EHDdUq4gyJZcJ+weClk3B5Qo='),
'cipher' => 'AES-256-CBC',
-- Save & Quit (:wq)
Step: 14. Create Apache Virtual Host :
# vi /etc/httpd/conf/httpd.conf
-- Add these Lines at Line no 313 :
<Directory /var/www/html/laravel/public>
Options -Indexes +Multiviews +FollowSymLinks
DirectoryIndex index.php index.html
AllowOverride All
Allow from all
</Directory>
-- Uncomment Line 996 :
NameVirtualHost *:80
-- Add this Line at the End of the File :
RewriteEngine on
-- Save & Quit (:wq)
# vi /etc/httpd/conf.d/10.100.97.38.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin techsupport@domain.com
ServerName 10.100.97.38
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/html
# Custom log file locations
LogLevel warn
ErrorLog /logs/10.100.97.38-error_log
SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
CustomLog /logs/10.100.97.38-access_log combined Env=!DontLog
</VirtualHost>
-- Save & Quit (:wq)
# vi /etc/httpd/conf.d/laravel.domain.com.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin techsupport@domain.com
ServerName laravel.domain.com
ServerAlias www.laravel.domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/html/laravel/public
# Custom log file locations
LogLevel warn
ErrorLog /logs/laravel.domain.com-error_log
SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
CustomLog /logs/laravel.domain.com-access_log combined Env=!DontLog
</VirtualHost>
-- Save & Quit (:wq)
# mkdir /logs
Step: 15. Start Apache Server :
# service httpd restart
# chkconfig httpd on
http://laravel.domain.com
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog
There are so many PHP frameworks but being a PHP developer I always prefer Laravel. This is the best framework for web development. And of course, the rest depends upon the project needs and requirements.
ReplyDeletedarkbears.com/hire-laravel-developer
Hire Laravel Developer for your business at affordable price.
darkbears.com/contact
Contact us for further discussion.
Good job! For Sharing your best ideas... I will refer the people to best learning and training Institute for online courses... click the below link:
ReplyDeleteshort courses in pakistan
react native advanced concepts
sorting algorithms c++
graphic designing institute
mern stack course online
php training institute
e commerce online course in pakistan
Tech inn Solutions
Good Job! You have Shared your well knowledge... I will refer the people to the best IT Solutions providers click the below link:
ReplyDeleteit solutions website
pakistan web developer
app development in pakistan
software developers in pakistan
digital marketing in pakistan
website maintenance packages
professional it consulting services
Cre8tivebot
Very useful article. To support Laravel web development demands, I would also like to share that Laravel is leading in Top 10K Sites, Top 100K Sites, Top 1M Sites and The Entire Web. In USA, laravel development companies are rapidly growing with its increasing demands.
ReplyDelete