树莓 php mysql,树莓搭建Nginx+PHP7.0+mysql服务器
累的一批,试了3个小时才搭建出来,想想还是先记录下来,一是为了警醒后人,二是为了防止我忘记emmmmm…
相信搜到我这文章的朋友大多是因为树莓诡异的PHP5装不上,php+nginx配置不上的原因找来的,废话不多说,我就把这3小时的工作的经验分享给大家
如有问题,加我QQ 393720616 一起讨论共同进步!
by zhazhafang
一、软件环境搭建
安装Nginx
sudo apt-get install nginx
如提醒安装失败,90%是端口占用,如之前装了apache2请先删除此软件再进行其他操作。
sudo apt-get remove apache2
安装PHP+MYSQL
sudo apt-get install php7.0
sudo apt-get install php7.0-mysql
注:网络上的PHP5已经无法安装,这里要将PHP5换做php7.0
二、设置更改 (重点)
sudo nano /etc/nginx/sites-available/default
打开后整个文件更改为:
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or WordPress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# 这里改动了,也可以写你的域名
server_name localhost;
root /var/www/php; #网页保存地址
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
# 这里改动了 定义首页索引文件的名称
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# 这里新加的
# PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI协议默认配置.
# Fastcgi服务器和程序(PHP,Python)沟通的协议.
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; #这里是关键老教程没有PHP7.0这段,不能正确引导
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #防止白屏
include fastcgi_params;
}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
保存配置存档,后运行一次
sudo /etc/init.d/nginx reload
三、测试
创建PHP文件
sudo nano /var/www/php/index.php
输入:
PHP 测试
<?php echo '
Hello World
'; ?>
存档保存。后运行:
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start
最后试试看你的Nginx+PHP+sqlite搭建成功了没有吧!
转载最好注明出处哟!
树莓 php mysql,树莓搭建Nginx+PHP7.0+mysql服务器相关推荐
- 【NGINX+PHP7.3+MYSQL】安装指南
文章目录 NGINX 添加源 --> 查看 安装 配置 设置开机启动 启动服务 停止服务 重新加载 防火墙 效果图 可能出现的问题 报 [emerg] bind() to 0.0.0.0:XXX ...
- 斐讯k3搭建nginx+php+MariaDB(mysql )的教程
安装nginx+php+MariaDB 以前用k3安装了onmp,中间踩了不少坑.以前发到贴吧的,现在发过来记录一下,顺便给大家参考一下. 斐讯k3性能比较强,拿来建小型网站还是可以的.但是内置储存太 ...
- php mate,[树莓派] ubuntu-mate配置nginx + php7.0环境
树莓派3b,系统 ubuntu-mate 16.04 1.安装 Nginx 和 PHP7 sudo apt-get update sudo apt-get install nginx php7.0-f ...
- 新浪云平台创建mysql数据库并使用php7.0版本连接
在新浪云平台上创建共享型mysql数据库 创建数据库 点击管理 选择导入 从navicat中取出已存在的sql文件 在navicat转储sql文件 注意,保存时文件要命名成新浪云数据库名 将转储 好的 ...
- apache php mysql环境搭建_Ubuntu+Apache+PHP+Mysql环境搭建(完整版)
Ubuntu+Apache+PHP+Mysql环境搭建(完整版) 一.操作系统 Ubuntu 14.04 64位,阿里云服务器 二.Apache 1.安装Apache,安装命令:sudo apt-ge ...
- mysql基础搭建_MySql基础-构建MySql数据库:安装MySql-server、MySql-client
1 构建MySQL服务器 1.1 问题 本案例要求熟悉MySQL官方安装包的使用,快速构建一台数据库服务器: 安装MySQL-server.MySQl-client软件包 修改数据库用户root的密码 ...
- Centos+Nginx+PHP7.0编译安装(和PHP5.6老版本共存)
来源:http://blog.csdn.net/liuxinmingcode/article/details/50319145 场景 LNMP 当前版本:PHP 5.5.7 为了体验PHP7的速度 ...
- CentOS7下搭建Nginx+PHP7的安装配置
一.安装编译工具及库文件: yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 环境要求 nginx是C ...
- QUIC实战(二) AWS 搭建nginx(http3.0) + upsync + consul(server-client模式) 集群
前面的博客介绍了怎么编译支持http3的nginx,并添加了upsync模块.为了在生产环境验证QUIC,我在aws搭建了一个Nginx + upsync + consul的集群 ,支持动态负载均衡. ...
最新文章
- 【书籍下载链接】_2_第二轮_计算机专业书籍
- linux系统怎么用wifi,【教程】Wii安装运行可用WIFI的Linux系统全攻略
- 如何用架构师思维解读区块链技术?
- 18.04升级到19.10
- python对分组进行排序_如何按排序顺序将列表中的项目分组?
- python的深拷贝和浅拷贝
- html 条款前面的选项,HTML内部测试笔试题.doc
- linux apache 依赖包,利用 yum 解决 Linux 软件包的依赖关系
- 2021年REITs行业发展研究报告
- 计算机操作系统-6-并发程序设计
- VMware View:VMware 专为 Kindle Fire 打造的视图客户端
- 微信订阅消息模板消息推送-JAVA
- linux 浮点测试,浮点运算性能测试
- Laravel 的闪存数据(Flash Data)
- 人工智能与大数据时代-2020
- SDK第一课(Windows SDK编程入门)
- NVP2650D+OX03C10,方案参考设计
- Hadoop快速入门——入门考试(伪分布式60+编码25+执行jar15)
- 【安全预警】WINRAR,7ZIP,WINZIP等存在严重漏洞
- 2021面试第二弹来袭
热门文章
- C# 串口SerialPort控件
- c#如何实现 汉字转换成区位码?
- 所示零件是减速器中的传动轴
- 首发体验!打自动驾驶出租车感觉如何?
- This function does not fully set the dimensions of output port 2 .
- YOLOv7部署于自定义数据集(BDD100K)
- oracle 多线程调用过程,oracle 存储过程 多线程
- php开发实战权威指南 张恩民,基于B/S模式的毕业论文管理系统
- 如何根据某一列数据合并多个excel为
- 前端利器,6 款开源 Web 性能优化辅助工具推荐