Notes on installing Laravel 5 on Linode

WBOY
Release: 2016-08-08 09:29:45
Original
1029 people have browsed it

I was learning PHP a few days ago and discovered the Laravel framework. When I first saw it, it was version 4.2. Last Thursday, I suddenly discovered that Laravel 5 was officially launched.
I haven’t had much exposure to frameworks because I’m not a coder, but I’ve always been interested in programming, so I started reading. I’ve seen Yii before and it made me dizzy. To be honest, I really don’t like it very much, but Laravel made me feel comfortable after seeing it.

I spent most of the day trying to install Laravel 5 on Linode, and I finally got to the welcome page. I’m very happy.

  1. Apply for a Linode server, I use ubuntu 14.4
  2. Install PHP

    • sudo apt-get update //Repository list upgrade
    • sudo apt-get install apache2 //Install apache server, ver 2.4.7
    • sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql //Install mysql
    • sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt //Install php5, the mcrypt extension is a must for Laravel Required
    • If you need to install other modules
      apt-cache search php5- //Get module list
      //List
      php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
      php5-cli - command-line interpreter for the php5 scripting language
      php5-common - Common files for packages built from the php5 source
      php5-curl - CURL module for php5
      php5-dbg - Debug symbols for PHP5
      php5-dev - Files for PHP5 module development
      php5-gd - GD module for php5
      php5-gmp - GMP module for php5
      php5-ldap - LDAP module for php5
      php5-mysql - MySQL module for php5
      php5-odbc - ODBC module for php5
      php5-pgsql - PostgreSQL module for php5
      php5-pspell - pspell module for php5
      php5-recode - recode module for php5
      php5-snmp - SNMP module for php5
      php5-sqlite - SQLite module for php5
      php5-tidy - tidy module for php5
      php5-xmlrpc - XML-RPC module for php5
      php5-xsl - XSL module for php5
      php5-adodb - Extension optimizing the ADOdb database abstraction library
      php5-auth-pam - A PHP5 extension for PAM authentication

      sudo apt-get install name of the module // Install

  3. Install Laravel

    • curl -sS https://getcomposer.org/installer | php //Install composer
    • composer global require “laravel/installer=~1.1” //Download the installer
    • export $PATH = PATH:”~/.composer/vendor/bin” //Add environment variables to facilitate direct execution Laravel
    • Now you can use Laravel commands to create a new site
      eg:
      Enter the var/www/html folder and execute
      Laravel new mysite
      After the execution is completed, a mysite folder will be created, and Laravel will be downloaded
  4. Simple configuration of the Vhost on the server points to this site
    Because apache2 is version 2.4.7, the configuration is slightly different

    Laravel needs sudo a2enmod rewrite //Enable the rewrite module

    • Configure Vhost //Spent some time here today
      Enter the etc/apache2/ folder and find sites-available

    • cp default.conf mysite.com.conf //The name before "conf" must be the same as the site you want

    • Edit and save

      ServerName mysite.com ServerAlias mysite.com ServerAdmin webmaster@mysite.com DocumentRoot /var/www/html/mysite/public/ #这里是public,laravel开始是从这里的index.php文件开始的 AllowOverrideAll #这个地方是要的,今天走了很多弯路这里 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from allErrorLog${APACHE_LOG_DIR}/error.log CustomLog${APACHE_LOG_DIR}/access.log combined 
      Copy after login
    • Add new site to server
      a2ensite mysite.com.conf (use a2disite xxxxx to delete)
      To check how many sites are enabled, go to the sites-enable folder and look at the files. .

  5. The storage folder in the Laravel directory needs to be given writable permission. Laravel uses this folder as the session storage area

  6. Check the .htaccess under the public under the mystie folder. Here is Laravel's rewrite configuration. Generally, you don’t need to touch anything

It’s all done, just go to the Domain and make an A record pointing to it, and then it’s OK

Phew. . Record what I did today. I spent a long time working on this redirection today
Because it is not turned on
AllowOverride All

Write this part here as a record, in case you accidentally help someone, it is also considered a good deed!

The above introduces the notes on Linode installation of Laravel 5, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!