Ubuntu + lamp + laravel Environment configuration

Source: Internet
Author: User
Tags curl curl openssl install php

First, lamp.

Installation order is a (Apache server) M (Mysql) P (PHP)

    1. Installing Apache

      sudo apt-get install apache2
    2. Install MySQL

      sudo apt-get install mysql-server mysql-client
    3. Install PHP and all related extensions

      sudo apt-get install php7.0 curl openssl php-curl php-pdo php-mbstring php-dom php-zip php7.0-mcrypt
    4. Installing Apache's PHP7 module

      sudo apt-get install libapache2-mod-php7.0

Here, the normal PHP project can run and put it in the/var/www/html directory.

But if you want to run the Laravel project, you need the following steps.

    1. Installing composer

      sudo curl -sS https://getcomposer.org/installer | php
    2. Move file to command directory

      sudo mv composer.phar /usr/local/bin/composer
    3. Composer Command

Modify Apache Configuration

/etc/apache2/apache2.conf's here.

<Directory/var/www/>         Options Indexes followsymlinks         allowoverride None         Require all granted</ Directory>

Change the None allowoverride none to all. Save Restart Apache2

(If you do not do this, then only/routes can be accessed, other routes are inaccessible)

Now you can put the project under the/var/www/html folder.

Get Permissions for the directory

To the/var/www/html/directory execution

CHMOD-R 777 Storage

If not, try this again.

Because Ubuntu Apache uses www-data users, it does not work properly to avoid permissions problems. We will public,storage,vendor three directory settings www-data belong to:
1 sudochown -R www-data /var/www/html/laravel/my_laravel/public/
2 sudochown -R www-data /var/www/html/laravel/my_laravel/storage/
3 sudochown -R www-data /var/www/html/laravel/my_laravel/vendor/

and such

    1. Set directory permissions (vendor, storage with writable permissions)

      //简单方式sudo chmod 0777 project -R
    2. Turn on rewrite module

      sudo a2enmod rewrite

In short, these are to get permission to the directory, if not get permission will appear open is a white panel, or 500 error

This should be OK, I have a long time, reference a few different articles. The next match should have experience. Take your time and get acquainted with it. Then take the time to match again, with pure command line to match, exercise your Linux operation ability.

Ubuntu + lamp + laravel Environment configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.