UBUNTU 环境LNMP搭建

ububtu16.04

  1. 换源(清华大学源/阿里)
   2。备份原文件 cd/etc/apt/
    然后会显示下面的源文件sources.list
输入命令
sudo cp sources.list sources.list.bak
就是将sources.list备份到sources.list.bak


sudo gedit sources.list打开文件,替换成清华源文件即可

清华大学源

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
 sudo apt-get update 更新源  
   sudo apt-get upgrade 更新软件 
安装nginx

apt-get install nginx
配置文件cd /etc/nginx/sites-available/defauder

# Default server configuration
#
server {
listen 80 ;
#listen [::]:80 default_server;



        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
             try_files $uri $uri/ /index.php?$query_string;

        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        #
        # # With php7.0-cgi alone:
        # fastcgi_pass 127.0.0.1:9000;
        # # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #

        location ~ /\.ht {
         deny all;
        }
}

安装php
安装mysql
apt-get install mysql-server mysql-client

sudo apt-get install php7.0-mbstring
sudo apt-get install curl

开始拉项目
成功之后修改权限

sudo chmod -R 777 storage/

sudo chmod -R 777 bootstrap/

sudo composer install
出现问题的话看一下什么问题有可能就是扩展没装

sudo apt-get install php7.0-dom

如果成功就生成key

php artisan key:gen

推荐阅读更多精彩内容