Build the environment required for Linux Laravel 5.5 from scratch (iii)

Source: Internet
Author: User

OK, we've installed the nginx+mysql+php, open the [Laravel 5.5 document] QuickStart-installation configuration

We see the need to install composer here, OK, we'll install the composer now.

We'll open the terminal first.

OK, we start to install composer, open composer Chinese web, pull down, probably in the middle of the position

See the three orders above? If you have previously installed the same as me, then execute the following three commands sequentially

Php-r "Copy (' Https://install.phpcomposer.com/installer ', ' composer-setup.php ');" php composer-setup.  -R "unlink (' composer-setup.php ');"

And then make it into a global, the above the green word, tell you composer installed where, the following command is to let you move the Composer.phar to the corresponding directory

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

Okay, we'll enter composer on the command line.

Composer

The appearance of such a picture, congratulations to you, composer installation success!

Then we changed the composer to a domestic mirror.

Composer Config-g Repo.packagist composer https://packagist.phpcomposer.com

Below we are ready to install Larvael, this is the first method (personally not recommended, select the second method please pull down) We first install the Laravel installer via Composer:

Global require "Laravel/installer"

Tell us we can't run composer as root, OK, let's create a user

# Admin for User name Useradd Admin # set password for admin passwd Admin

OK, let's switch to Admin user

# Root does not need to enter a password when switching to another user # But when other users switch to the root super administrator, they need to enter the password su admin

Okay, let's try it again. Installing the Laravel Installer

Global require "Laravel/installer"

At this step, the Laravel installer is installed, so let's try it.

First switch to the/home/admin directory and create a new app

# Create a new Larvael application, blog for the application name cd/home/New Blog

Prompt command not found, OK, let's set the system variable

Open this file and add it to the last line

Vim/etc/profile
#路径是你自己的路径, remember, change here is to permanently add environment variables (affect all users)
Export path= "/home/admin/.config/composer/vendor/bin: $PATH"

Save, exit, and then run:

Source/etc/profile

No error is successful, then we switch to the WWW directory, and then try to

New Test

See this shows that we have installed the Larvael, through this method installed a bit of a problem, the lack of vendor, and then access is not accessible, specific reasons to check later

The second method: we install it directly through the composer method.

Use the command:

#test为你项目名称, followed by the version number composer Create 5.5

The above screen is installed, after installation, configure the Nginx site, and then access

Vim/etc/nginx/nginx.conf

Configuration file Code:

Server {Listen80;#Listening Portserver_name localhost;#site domain name        #CharSet koi8-r;        #access_log Logs/host.access.log main;root/home/wwwroot/blog/ Public/;#Site root directoryLocation/{Index Index. html index.htm index.php l.php;#Default Navigation pageAutoIndex off; Try_files$uri $uri//index.php?$query _string; }        #error_page 404/404.html;        #Redirect Server error pages to the static page/50x.html        #Error_page 502 503 504/50x.html; Location=/50x.HTML {root HTML; }        #Proxy The PHP scripts to Apache listening on 127.0.0.1:80        #        #Location ~ \.php$ {        #Proxy_pass http://127.0.0.1;        #}        #Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #Location ~ \.php (. *) $ {fastcgi_pass127.0.0.1:9000; Fastcgi_index Index.PHP; Fastcgi_split_path_info^((? U). +\.php) (/?. +)$; Fastcgi_param Script_filename$document _root$fastcgi_script_name; Fastcgi_param Path_info$fastcgi _path_info; Fastcgi_param path_translated$document _root$fastcgi_path_info; includeFastcgi_params; }        #deny access to. htaccess files, if Apache ' s document Root        #concurs with Nginx ' s one        #        #Location ~/\.ht {        #deny all;        #}}

Obviously, no permissions ... Because is to take the admin user to create the Laravel, while the proxy user is WWW, two practices. Blog All files are changed to www.www permissions or only to storage 777 permissions

# notice where your current directory is chmod 777-r blog/storage/

OK, now let's refresh the page, the long-awaited welcome page has finally appeared

Okay, that's it, laravel5.5. The installation is complete and the rest should be done.

There are a lot of bad and do not understand, please leave a message to exchange discussions, thank you

Build the environment required for Linux Laravel 5.5 from scratch (iii)

Related Article

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.