安装nginx

首先更新软件包 并且安装nginx

sudo apt-get update
sudo apt-get install nginx

开放防火墙配置

sudo ufw allow 'Nginx HTTP'

查看防火墙状态

sudo ufw status

------------------
Status: active To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)

访问服务器看看nginx是否配置成功

http://server_domain_or_IP

2安装mysql

sudo apt-get install mysql-server

安装期间会配置数据库的root密码 而且默认的root账户不可以远程登录
如果密码忘了可以执行如下命令来重设密码

sudo mysql_secure_installation

如果需要远程登录mysql的root账户

可以执行
```
mysql -uroot -p
输入root密码 进入mysql命令行
执行mysql命令

mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;

然后重启msql 就可以远程root登录了

service mysql restart
```

3安装php

sudo apt-get install php-fpm php-mysql

配置php

sudo vim /etc/php/7.0/fpm/php.ini

修改cgi.fix_pathinfo为0,防止安全泄露

cgi.fix_pathinfo=0

保存关闭 ,重启php

sudo systemctl restart php7.0-fpm

配置nginx 使用php

找到站点配置

sudo vim /etc/nginx/sites-available/default

大概修改成下面这样,根据情况自行配置
```
server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html; server_name server_domain_or_IP; location / {
try_files $uri $uri/ =404;
} location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
} location ~ /\.ht {
deny all;
}

}
```

只需要保证 index配置有index.phplocation中有fastcgi_pass 并且配置正确就可以

检查nginx配置

sudo nginx -t

重启nginx

sudo systemctl reload nginx
当然 service也可以
service nginx restart

5添加php文件测试配置

sudo vim /var/www/html/info.php

添加下面代码

<?php
phpinfo();

保存关闭

访问服务器

http://server_domain_or_IP/info.php

如果是下图 择说明php工作正常!

完事记得删除 否则会泄露服务器信息

在ubuntu16.04上安装php7 mysql5.7 nginx1.10并支持http2的更多相关文章

  1. Ubuntu16.04上安装neo4j数据库

    什么是neo4j数据库? neo4j数据库是图数据库的一种,属于nosql的一种,常见的nosql数据库还有redis.memcached.mongDB等,不同于传统的关系型数据库,nosql数据也有 ...

  2. 在ubuntu16.04上安装eclipse

     在ubuntu16.04上安装eclipse 一.下载     首先我们需要安装jdk1.8及其以上,然后从官网:https://www.eclipse.org/downloads/上下载,需要注意 ...

  3. Ubuntu16.04上安装cudnn教程和opencv

    https://blog.csdn.net/wang15061955806/article/details/80791112 Ubuntu16.04上安装cudnn教程 2018年06月24日 14: ...

  4. CentOS 7 安装 LNMP 环境(PHP7 + MySQL5.7 + Nginx1.10)

    记录下在CentOS 7 安装 LNMP 环境(PHP7 + MySQL5.7 + Nginx1.10)过程笔记. 工具 VMware版本号 : 12.0.0 CentOS版本 : 7.0 一.修改 ...

  5. 通过Anaconda在Ubuntu16.04上安装 TensorFlow(GPU版本)

    一. 安装环境 Ubuntu16.04.3 LST GPU: GeForce GTX1070 Python: 3.5 CUDA Toolkit 8.0 GA1 (Sept 2016) cuDNN v6 ...

  6. Ubuntu16.04 上安装MySQL5.7

    Ubuntu版本:16.04.4 1.先更新最新的源 sudo apt-get update 2.查看是否已经安装过mysql sudo netstat -tap | grep mysq 如果没有安装 ...

  7. ubuntu16.04上安装配置DHCP服务的详细过程

    DHCP服务器是为客户端机器分配IP地址的,所有分配的IP地址都保存在DHCP服务器的数据库中.为了在子网中实现DHCP分配IP地址,需要在目标主机上安装配置DHCP服务 1. 安装DHCP服务 安装 ...

  8. Ubuntu16.04上安装mongoDB

    安装MongoDB 现在最新版本是3.4 1: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F37303 ...

  9. Centos 7.3 搭建php7,mysql5.7,nginx1.10.1,redis

    一.安装nginx 更新系统软件(非必要) # yum update 安装nginx 1.下载nginx # wget http://nginx.org/download/nginx-1.15.2.t ...

随机推荐

  1. web.xml配置之<context-param>详解

    读完本文,你将了解(1)<context-param>的作用和用法,(2)<context-param>配置和<init-param>的区别 <context ...

  2. mysql中int(M) tinyint(M)中M的作用

    原先对mysql不太理解,但也没有报错.但理解的不够深入.这次补上. 原来以为int(11)是指11个字节,int(10)就是10个字节.我错了. http://zhidao.baidu.com/li ...

  3. List To Json

    命名空间 using Newtonsoft.Json; 实例代码 /// <summary> /// 将list集合转换为json /// </summary> /// < ...

  4. Python中用format函数格式化字符串的用法(2.7版本讲解哦!)

    语法 它通过{}和:来代替%.“映射”示例 通过位置 In [1]: '{0},{1}'.format('kzc',18) Out[1]: 'kzc,18' In [2]: '{},{}'.forma ...

  5. Filter FASTA files

    Use a regular expression for filtering sequences by id from a FASTA file, e.g. just certain chromoso ...

  6. Caffe python利用classify.py实现对单通道(灰度图)的数据进行分类

    比如你在mnist的prototxt中定义图输入是单通道的,也就是channel=1,然后如果直接调用classify.py脚本来测试的话,是会报错,错误跟一下类似. Source param sha ...

  7. windows系统下载地址大全&大白菜下载和教程

    win10的 Windows10 64位纯净系统下载(不建议,后面的有原版) http://cjxt.sysdaa.com/down.php?post=win10-64&action=bend ...

  8. spring boot项目获取application配置文件参数的两种方式

    前言:了解过spring boot这个技术的,应该知道spring boot的核心配置文件application.properties,当然也可以通过注解自定义配置文件**.properties的信息 ...

  9. MSSQL2005数据库显示单一用户模式,无法进行任何操作

    MSSQL2005数据库显示单一用户模式,无法进行任何操作 经查询,使用exec sp_who进行查看链接线程,发现仍然有链接不断进行请求,将链接踢出,然后通过命令修复即可恢复 处理步骤: exec ...

  10. shell read

    #!/bin/bash read -p "Enter your account:" acct #提示用户输入用户名read -s -p "Enter your passw ...