Ubuntu16.04 lnmp 环境搭建
Ubuntu16.04 lnmp 环境搭建
nginx 安装
sudo apt-add-repository ppa:nginx/stablesudo apt-add-repository ppa:ondrej/phpsudo apt updatesudo apt install -y nginxsudo nginx
之后访问ip 出现nginx 欢迎界面
2.安装php
sudo apt install -y php7.1 php7.1-mysql php7.1-fpm php7.1-curl php7.1-xml php7.1-mcrypt php7.1-json php7.1-gd php7.1-mbstring php7.1-zip php-mongodb php-memcached php-redis
注意:sudo apt-cache search php7* 可以查询PHP模块扩展
3.安装mysql
sudo apt –y install mysql-server mysql-client
注意:期间要设置密码,填两次密码,
注意:查看nginx 和fastcgi通信有2种方式,一种是TCP方式,还有种是UNIX Socket方式。
查看命令如下:
sudo vim /etc/php/7.1/fpm/pool.d/www.conf
默认是socket方式 listen = /run/php/php7.1-fpm.sock
另外一种TCP方式 #listen = 127.0.0.1:9000
检查配置文件:sudo php-fpm7.1 -t
修改重启下 php-fpm7.0: sudo service php-fpm7.0 restart (/etc/init.d/php7.0-fpm restart)
修改nginx配置文件sudo vim(或vi) /etc/nginx/sites-enabled/default
4.修改nginx配置文件
sudo vim /etc/nginx/sites-available/default
添加index.php入口文件:
index index.php index.html index.htm index.nginx-debian.html;
然后打开nginx自带的php设置就行了
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.1-fpm.sock;
}
然后 sudo service nginx restart (/etc/init.d/nginx restart)
注意:重启nginx失败 先ps -ef | grep nginx 后 pkill -9 nginx 然后重启
5.新建index.php
cd /var/www/htmlvim index.php
注意:腾讯云给的账号是ubutu,不是root,所以要设置root 密码
sudo passwd root ps:填两次密码
sudo vim /etc/ssh/sshd_config
将PermitRootLogin后面的prohibit-password改为yes
sudo service ssh restart
su -
然后就可以 vim index.php 不然会报权限不足
原文地址:https://segmentfault.com/a/1190000016777859
Ubuntu16.04 lnmp 环境搭建的更多相关文章
- Python在ubuntu16.04上环境搭建
1.anaconda3安装 mkdir anaconda cd anaconda wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linu ...
- ubuntu16.04 开发环境搭建
1.更换源 sudo gedit /etc/apt/sources.list 2.更新系统 sudo apt-get update sudo apt-get dist-upgrade 3.移动 ...
- R在ubuntu16.04上环境搭建
1.R安装 sudo apt-get update sudo apt-get remove vim-common sudo apt-get install vimapt-cache show r-ba ...
- Ubuntu16.04.1上搭建分布式的Redis集群
为什么要集群: 通常为了,提高网站的响应速度,总是把一些经常用到的数据放到内存中,而不是放到数据库中,Redis是一个很好的Cache工具,当然了还有Memcached,这里只讲Redis.在我们的电 ...
- LNMP环境搭建:Nginx安装、测试与域名配置
Nginx作为一款优秀的Web Server软件同时也是一款优秀的负载均衡或前端反向代理.缓存服务软件 2.编译安装Nginx (1)安装Nginx依赖函数库pcre pcre为“perl兼容正则表达 ...
- Ubuntu16.04.1上搭建分布式的Redis集群,并使用C#操作
为什么要集群: 通常为了,提高网站的响应速度,总是把一些经常用到的数据放到内存中,而不是放到数据库中,Redis是一个很好的Cache工具,当然了还有Memcached,这里只讲Redis.在我们的电 ...
- LNMP环境搭建
LNMP环境搭建 Linux + Nginx + MySQL + PHP PHP是一种脚本语言,当前中国乃至世界上使用PHP语言开发的网站非常普遍 Nginx是一个web服务软件,和apache是一类 ...
- 阿里云(ECS)Centos服务器LNMP环境搭建
阿里云( ECS ) Centos7 服务器 LNMP 环境搭建 前言 第一次接触阿里云是大四的时候,当时在校外公司做兼职,关于智能家居项目的,话说当时俺就只有一个月左右的 php 后台开发经验(还是 ...
- ubuntu16.04 ROS环境下配置和运行SVO
ubuntu16.04 ROS环境下配置和运行SVO https://blog.csdn.net/nnUyi/article/details/78005552
随机推荐
- node——request和response的常用对象
request(http.IncomingMessage)和response(http.ServerResponse)对象介绍 request:服务器解析用户提交的http请求报文,将结果解析到req ...
- easyUI datagrid的合并的js封装
$.extend($.fn.datagrid.methods, { autoMergeCells : function (jq, fields) { return jq.each(function ( ...
- python3配置爬虫开发环境
爬虫:环境搭建 安装python3: 安装python版本:3.7.0 winsdows下的配置:
- 通过页面预加载(preload)提升小程序的响应速度
GitHub: https://github.com/WozHuang/mp-extend 主要目标 如果小程序在打开新页面时需要通过网络请求从接口中获取所用的数据,在请求完成之前页面都会因为没有数据 ...
- UVA10082-WERTYU(紫书例题3.2)
A common typing error is to place the hands on the keyboard one row to the right of the correct posi ...
- hdu5791 TWO
hdu5791 TWO 题意 给你两个数串 问你两个数串有多少子串一致 子串不一定是连续的 解法 我们设 \(dp[i][j]\) 表示A串匹配到 i 位,B串匹配到 j 位,一致的子串数.那么我们有 ...
- Vue常用的GitHub项目
Vue常用的GitHub项目(Demo案例) 应用实例 https://github.com/pagekit/pa... pagekit-轻量级的CMS建站系统 https://github.com/ ...
- js jquery 判断匹配元素是否存在
jQuery 判断页面元素是否存在的代码 在传统的Javascript里,当我们对某个页面元素进行某种操作前,最好先判断这个元素是否存在.原因是对一个不存在的元素进行操作是不允许的. 例如: 复制代码 ...
- ZOJ 3640
很简单的概率题了 设dp[x]为能力值 为x时出去的期望 天数 #include <iostream> #include <cstdio> #include <cmath ...
- [ReactVR] Add Shapes Using 3D Primitives in React VR
React VR ships with a handful of 3D primitives. We'll importprimitives like <Sphere/>, <Box ...