Installing server Components
sudo apt-get//获得最近的软件包的列表sudo apt-get//安装Nginx服务器sudo apt-get install php5-fpm//安装php5sudo apt-get install php5-cli//安装php5在命令行运行的接口sudo apt-get install php5-mcrypt//安装php5加密拓展库sudo apt-get install php5-mysql//安装php的MySQL驱动sudo apt-get//安装git神器
The command installs Nginx as our web server and PHP locale.
Git is installed because the underlying component of the composer tool is Git,
We will use composer to install Laravel and update the related packages.
Modify PHP configuration file
Open the PHP configuration file. Find Cgi.fix_pathinfo modified to 0, as follows:
sudo vim/etc/php5/fpm/php.ini
Cgi.fix_pathinfo=0
Save and exit because this is a possible security vulnerability.
Enable MCrypt extensions using Php5enmod:
sudo php5enmod mcrypt
Now we need to restart the PHP5-FPM service:
sudo service php5-fpm restart
PHP has been configured to complete.
Configuring Nginx and Web Directories
To create a site directory:
sudo mkdir-p/var/www/laravel
Open nginx Default configuration file:
sudo vim/etc/nginx/sites-available/default
server { 8000; //监听端口 server_name www.phpcto.com; //域名 root /var/www/laravel/public; //指定文件的public index index.php index.html index.htm; server_name server_domain_or_IP; location / { $uri$uri/ /index.php?$query_string; } location ~ \.php$ { $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; $document_root$fastcgi_script_name; include fastcgi_params; }}
After the modification, we need to restart the Nginx service:
sudo service nginx restart
Enter the host file plus IP and set the domain name
sudo gedit/etc/hosts
127.0.0.1 www.phpcto.com
Install Composer "Turn on the Wall software"
CD ~
Curl-ss Https://getcomposer.org/installer | Php
In the current directory will find Composer.phar This file, this file is the COMPOESR executable file, we need to move to/usr/local/bin, so that the global can call composer.
sudo mv Composer.phar/usr/local/bin/composer
Composer Installation Complete
Installing Laravel
1. We use composer to install Laravel 5 to/var/www/laravel.
Cd/var/www/laravel
sudo composer Create-project Laravel/laravel laravel
To change the group that the site directory belongs to:
sudo chown-r: www-data/var/www/laravel
/var/www/laravel This directory stores temporary files laravel various services, so write permissions are required:
sudo chmod-r 775/var/www/laravel
At this point, enter the domain name plus port number in the browser
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the deployment of nginx,laravel51 in Ubuntu, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.