安装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.php 在location中有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. oracle中记录被另一个用户锁住的原因与解决办法

    oracle数据中删除数据时提示“记录被另一个用户锁住” 解决方法: 1.查看数据库锁,诊断锁的来源及类型: select object_id,session_id,locked_mode from ...

  2. Python框架之Tornado (源码之褪去模板外衣)

    上一篇介绍了客户端请求在tornado框架中的生命周期,其本质就是利用epoll和socket来获取并处理请求.在上一篇的内容中,我们只是给客户端返回了简单的字符串,如:“Hello World”,而 ...

  3. display:inline与display:block——行内元素显示与块级元素显示

    display:inline 的作用是设置对象做为行内元素显示,inline是内联对象的默认值(ps:内联对象就是不自动产生换行的元素,比如span) 而我们一般用的div是块级元素,默认displa ...

  4. cf100989b

    http://codeforces.com/gym/100989/my B. LCS (B) time limit per test 0.25 seconds memory limit per tes ...

  5. hadoop29---自定义注解

    自定义注解: package cn.itcast_04_springannotation.userdefinedannotation.annotation; import java.lang.anno ...

  6. vue2.0 transition 多个元素嵌套使用过渡

    在做vue的demo的时候遇到一个问题,多个嵌套的元素如何设置transition? 我的代码:代码中元素整体做平移,里面的inner中做旋转,实现一个圆形滚动的效果 <transition n ...

  7. Arcgis Javascript API 开发笔记

    JS API3.4的要求 à(1)  IE9或以上版本 否则dijit1.8.3不匹配 1.如何发布ArcgisJavascript API应用 0.准备工作: (1).有web应用: (2).有js ...

  8. [转] Android Fragment 你应该知道的一切

     转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/42628537,本文出自:[张鸿洋的博客] 很久以前写过两篇Fragment的介 ...

  9. javascript页面打印

    打印本身比较简单,但要考虑到具体的需求.比如 1. 多浏览器: if (isIE()) { //打印预览 WebBrowser1.execWB(7, 1); } else { window.print ...

  10. 不常用的gcd公式

    gcd(a^m-b^m,a^n-b^n)=a^(gcd(m,n))-b^(gcd(m,n))