First, lamp.
Installation order is a (Apache server) M (Mysql) P (PHP)
Installing Apache
sudo apt-get install apache2
Install MySQL
sudo apt-get install mysql-server mysql-client
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
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.
Installing composer
sudo curl -sS https://getcomposer.org/installer | php
Move file to command directory
sudo mv composer.phar /usr/local/bin/composer
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 |
$ sudo chown -R www-data /var/www/html/laravel/my_laravel/public/ |
2 |
$ sudo chown -R www-data /var/www/html/laravel/my_laravel/storage/ |
3 |
$ sudo chown -R www-data /var/www/html/laravel/my_laravel/vendor/ |
and such
Set directory permissions (vendor, storage with writable permissions)
//简单方式sudo chmod 0777 project -R
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