Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel
Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel
1、MySQL安装【安装 MariaDB】
MariaDB是MySQL的一个分支
首先,更新升级系统
$ sudo apt update
$ sudo apt upgrade
安装MariaDB:
$ sudo apt install mariadb-server
启动MariaDB服务:
$ sudo systemctl start mysql
$ sudo systemctl enable mysql
查看状态:
$ sudo systemctl status mysql
为例提高MariaDB的安全,我们可以执行初始化安全脚本:
$ sudo mysql_secure_installation
默认root密码为空;然后设置root密码和其他选项:
- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y
登陆MariaDB命令行:
$ sudo mysql -u root -p
2、安装php5.6
Ubuntu 16.04 默认提供的是php7.0,版本太高,本人想测试Laravel,需要5.6版本的PHP
实现方法如下:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6
【需要额外安装一些extension如:php5.6-gd php5.6-mbstring php5.6-mysql php5.6-zip php5.6-xml php5.6-mcrypt】【fpm???】
3、安装Nginx
如果安装了apache2先卸载再安装nginx
service apache2 stop
update-rc.d -f apache2 remove
apt-get remove apache2
安装ngnix【安装过程不会自动创建目录,需要手动创建如/var/www/html】
apt-get install ngnix
service ngnix start
浏览器浏览验证是否安装成功,出现下面页面说明安装成功
4、配置ngnix
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/blogtest/public;
index index.html index.php index.htm index.nginx-debian.html;
server_name 192.168.198.138;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
;
include fastcgi_params;
}
}
--------------------------
重启ngnix:
service ngnix restart
==================================================================
5、安装Laravel及新建工程
apt-get install composer
composer global require "laravel/installer"
在/var/www/html中【composer不建议施用root用户来执行命令】
sudo composer create-project --prefer-dist laravel/laravel blogtest
修改文件所有者:
chown -R www-data:www-data blogtest/
6、浏览器访问
Ubuntu 16.04 LTS 安装 Nginx/PHP 5.6/MySQL 5.7 (LNMP) 与Laravel的更多相关文章
- Ubuntu 16.04 LTS安装 TeamViewer
Ubuntu 16.04 LTS安装 TeamViewer 64位Ubuntu 16.04系统需要添加32位架构支持,命令如下. sudo dpkg --add-architecture i3 ...
- Ubuntu 16.04 LTS 安装 miniconda
Ubuntu 16.04 LTS 安装 miniconda 下载 miniocnda 的 bash 文件下载链接 https://conda.io/miniconda.html ,我选择的是 64-b ...
- Ubuntu 16.04 LTS安装好需要设置的15件事(喜欢新版本)
看到这篇文章说明你已经从老版本升级到 Ubuntu 16.04 或进行了全新安装,在安装好 Ubuntu 16.04 LTS 之后建议大家先做如下 15 件事.无论你是刚加入 Ubuntu 行列的新用 ...
- Ubuntu 16.04 LTS安装好之后需要做的15件事
看到这篇文章说明你已经从老版本升级到 Ubuntu 16.04 或进行了全新安装,在安装好 Ubuntu 16.04 LTS 之后建议大家先做如下 15 件事.无论你是刚加入 Ubuntu 行列的新用 ...
- Ubuntu 16.04 LTS 安装libvips出现”Package vips was not found in the pkg-config search path”
使用libvips来操作图像,libvips的部署参考一个Node.js工程:https://github.com/lovell/sharp 在MAC下安装很顺利,到Linux环境下(Ubuntu 1 ...
- Ubuntu 16.04 LTS安装Docker并使用加速器
参考优酷:http://v.youku.com/v_show/id_XMTkxOTYwODcxNg==.html?spm=a2h0k.8191407.0.0&from=s1.8-1-1.2 首 ...
- 如何在Ubuntu 16.04上安装Nginx
原文链接https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04 介绍 Nginx是世 ...
- ubuntu 16.04 LTS安装jenkins服务器
官方网站:https://jenkins.io/ 这里我们的系统是Ubuntu 16.04,所以选择Ubuntu的版本,另外,为什么选择2.60.3,而不是新的2.77?因为2.60.3是LTS版本, ...
- Ubuntu 16.04 LTS 安装配置 Nginx 1.10.0 Php7.0-FPM
1. 安装Nginx,Php-7.0 ~$ sudo add-apt-repository ppa:nginx/stable ~$ sudo apt-get update ~$ sudo apt-ge ...
随机推荐
- 我的jsonp跨域问题
关于jsonp跨域问题,在这个方面也是了解一点点,先记录下来,主要作为以后查看,之前下载并安装过wampserver,了解到了jsonp和json的区别,现在谈谈跨域这个问题: 首先什么是跨域,简单地 ...
- 浅谈Json和jsonp
定义: JSON:是一种数据交换格式, JSONP是一种依靠开发人员的聪明才智创造出的一种非官方跨域数据交互协议 曾经看到一个有意思的例子:JSON是地下党们用来书写和交换情报的“暗号”的话, 而JS ...
- 使用二级域名访问本地localhost网站
将C:\Windows\System32\drivers\etc\hosts文件,修改如下.保存该文件时会提示没有权限,解决的方法是用管理员权限打开记事本. # localhost name reso ...
- Interview Tests
1,wpf特点: 1:MVVM模式. 2:数据和视图分离 3:高级的数据模板功能 4:高级数据绑定功能 5:高级动画支持 6:高级图形和3D支持 7:灵活的控件组合 2,依赖属性的原理:Depende ...
- Android开发环境配置
由于公司项目需要,最近转做Android开发,这里我来介绍一下Android开发环境的配置过程. 首先,需要下载所需要的软件工具,如下所示: 1.Java:开发基础环境,JDK和JRE这两个都要下载的 ...
- Runtime实战之定制TabBarItem大小
方案一:UIEdgeInsets 适用场景: 适合APP的TabBarItemImage的图片资源放在本地 图片超出tabbar的高度,需移动其位置,来进行适应 弊端: 若在本地配置好后,tabbar ...
- [原创]-bash: iostat: command not found解决办法
[root@testhost ~]# iostat-bash: iostat: command not found IOSTAT 命令不可用,首先确认sysstat包是否安装,sysstat包中包括i ...
- ASP.NET MVC location.href不跳转
表单使用submit导致不跳转 <button type="button">
- css响应式布局RWD
响应式布局结合了三大理念: 1)用于布局的弹性网络(百分比定义宽度) 2)用于图片和视频的弹性媒体 3)媒体查询 在布局中,需要注意的点有: 1)尽量用min-width/max-width,max- ...
- object_id用法
特别是在建表建存储过程的时候进场会写到: IF OBJECT_ID('Table_Test','U') IS NOT NULL DROP TABLE Table_Test 这种方式代替了以往所使用的 ...