My environment
Aliyun Ubuntu 14.04.2
Root login, if you need permission in the tutorial don't forget to use sudo
Install PHP, Nginx
Upgrade Apt-get
Apt-get Update
Install Nginx, PHP
Apt-get install Nginx php5-fpm php5-cli php5-mcrypt
Configure PHP
Vim/etc/php5/fpm/php.ini
Search Cgi.fix_pathinfo and modify the value to 0, and don't forget to remove the annotation
Cgi.fix_pathinfo=0
Enable MCrypt extensions, Laravel need this
Php5enmod MCrypt
Restart the PHP5-FPM service
Service PHP5-FPM Restart
My collection of Vi/vim instruction collation
To create a Laravel project using composer
CD ~
Curl-ss Https://getcomposer.org/installer | Php
Then use LS you will find that there are composer.phar in the ~ directory
We need to put it in the/usr/local/bin directory to complete the installation.
MV Composer.phar/usr/local/bin/composer
Create a folder to place the Laravel item, which I created and placed under/var/www/
Mkdir-p/var/www/laravel
You can then create a project
Composer Create-project Laravel/laravel/var/www/laravel
Configure Nginx
Vim/etc/nginx/sites-available/default
Modify the content to the following
server {
Listen default_server;
Listen [::]:80 default_server Ipv6only=on;
Root/var/www/laravel/public;
Index index.php index.html index.htm;
server_name server_domain_or_ip;
Location/{
Try_files $uri $uri//index.php $query _string;
}
Location ~ \.php$ {
Try_files $uri/index.php = 404;
Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
Fastcgi_pass Unix:/var/run/php5-fpm.sock;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
}
Reboot Nginx after storage
Service Nginx Restart
Note Root, which makes the value the public directory of the Laravel project
The value of the server_name can be a domain name or an IP address
Location is the extension file for PHP
To Permissions
I configured the time to think that the completion of the above configuration is finished, the result of the input IP address, the page is empty, check a long time data, only to find that no permissions
Change the group to which the site directory belongs
Chown-r: Www-data/var/www/laravel
Storage directory stores temporary files laravel various services, so write permissions are required
Chown-r: Www-data/var/www/laravel/storage
Additional
If you want to import a project from Git, do not forget to perform the composer install instruction in the directory after importing
If you need to use MySQL, you will have to install it extra. You need to configure the. env file correctly, using the PHP artisan migrate instruction to generate the table