elementaryos5安装mysql5.7、php7.2、nginx1.14.0
一、mysql5.7
安装mysql5.7:
sudo apt-get install mysql-server-5.7
查看安装的mysql版本:
mysql -V
5.7版本mysql安装过程中以及安装完毕都不会提示设置密码
配置用户名密码:
su mysql
show databases;
use mysql;
update user set authentication_string=PASSWORD("123456") where user='root';
update user set plugin="mysql_native_password";
flush privileges;
quit;
修改完毕,重启mysql:
sudo /etc/init.d/mysql restart或者sudo systemctl restart mysql
二、安装nginx1.14.0:
sudo apt-get install nginx
访问下127.0.0.1看看有没有欢迎界面就行了
三、安装php7.2
sudo apt-get install php7.2-fpm php7.2-mysql
之后可能还需要gd之类的,可以sudo apt-get install php7.2然后按下tab会自动提示
四、配置nginx支持php,要不然访问php就变成了下载文件
备份一个先:
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
编辑配置文件
sudo vim /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;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.php index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# 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;
# }
#}
#
#虚拟主机
server {
listen 8000;
#listen [::]:80;
server_name localhost;
root /home;
index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
}
}
其中最重要的就是:如果需要虚拟主机,虚拟主机配置里面也要添加location ~ \.php$ {...
虚拟主机配置项:
sudo vim /etc/nginx/sites-available/default
文件底部添加就行了

elementaryos5安装mysql5.7、php7.2、nginx1.14.0的更多相关文章
- 2018.7.3 lnmp一键安装包无人值守版本 php7.2 + nginx1.14.0 + mariadb5.5 + centos7.1(1503) 环境搭建 + Thinkphp5.1.7 配置
给自己练习用的,整个过程追求一个简单粗暴,没有配置虚拟主机,现在记录一下过程. 1. 进入到lnmp解压缩后的文件夹conf/rewrite,把thinkphp.conf复制一份到/usr/local ...
- nginx1.14.0下载、安装、启动
nginx1.14.0下载及安装 wget http://nginx.org/download/nginx-1.14.0.tar.gztar -zxvf nginx-1.14.0.tar.gzcd n ...
- CentOS 安装Nginx1.14.0
原文地址:http://www.cnblogs.com/ascd-eg/p/9275441.html 一.安装所需环境 1.gcc 安装 yum install gcc-c++ ...
- 编译安装和apt安装Nginx1.14.0
安装依赖 yum -y install gcc gcc-c++yum -y install zlib zlib-devel openssl openssl-devel pcre-devel 在Ubun ...
- CentOS7 安装nginx-1.14.0
nginx源码包:http://nginx.org/en/download.html 1.安装gcc gcc是用来编译下载下来的nginx源码 yum install gcc-c++ 2.安装pcre ...
- Centos7安装Nginx1.14.0
一.官网下载 http://nginx.org/en/download.html 版本说明: Nginx官网提供了三个类型的版本 Mainline version:Mainline 是 Nginx 目 ...
- Nginx1.14.0+ModSecurity实现简单的WAF
一.编译安装Nginx 1.安装依赖环境 $ yum -y install gcc-c++ flex bison yajl yajl-devel curl-devel curl GeoIP-devel ...
- nginx1.14.0版本https加密配置
修改host文件,为最后访问域名准备 C:\Windows\System32\drivers\etc host文件目录192.168.10.140 www.joyce.com 在最后添加这个自定义域名 ...
- Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法
Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法原因:Scrapy需要的组 twisted 需要 C++环境编译. 方法一:根据错误提示去对应 ...
随机推荐
- 文件上传 Window & Linux
1. 在application配置文件添加图片存储路径的参数 上传路径前必须加 file:/ 否则网页图片请求可能404window gofy: uploadPath: file:/F:/fileUp ...
- 【Net】ABP框架学习之正面硬钢
前言 本文介绍另一种学习ABP框架的方法,该方法为正面硬钢学习法... 我们不去官网下载模板,直接引用DLL,直接使用. WebApi项目创建 首先创建一个WebApi项目,结构如下. 然后Nuget ...
- scikit_learn分类器详解
1 分类 分类是将事物按特性进行分类,例如将手写数字图片分类为对应的数字. 1.1 MINIST数字图片集分类 MINST就是一个70000张规格较小的手写数字图片,如何将他们分类为对应 ...
- EOS基础全家桶(六)账号管理
简介 本篇我们会学习最基本的账号相关的操作,包括了创建账号和查询,关于账号资源的操作因为必须先部署系统合约,所以我们会留到后面单独写一篇来讲解. 6-EOS基础全家桶(六)账号管理 简介 账号介绍 账 ...
- Android如何快速打出100个渠道apk
测试1分钟900多个包 关键思路就是读文件,如图: Python快速打包脚本: #!/usr/bin/env python import zipfile prefix = 'channel_' cha ...
- MyBatis(八):高级结果映射
本文是按照狂神说的教学视频学习的笔记,强力推荐,教学深入浅出一遍就懂!b站搜索狂神说或点击下面链接 https://space.bilibili.com/95256449?spm_id_from=33 ...
- 家庭记账本app进度之关于单选按钮的相关操作(添加点击按钮事件以及点击单选更改事件)
这次主要是通过代码实现了android中的相关单选按钮的相关操作,之后再最下面有一个按钮,当点击这个按钮的时候,会获取当上面的相关信息,之后再下方会进行相应的文字显示,获取的信息不同显示的信息也不会一 ...
- javascript入门 之 zTree(十二 托拽事件(二))
1.逻辑可能有不完善的地方,如果发现,请指出. <!DOCTYPE html> <HTML> <HEAD> <TITLE> ZTREE DEMO - d ...
- 33.2 案例:输出指定目录下的所有java文件名(包含子目录)
package day32_file_文件和目录操作; import java.io.File; public class test_输出指定目录下所有的java文件名 { public static ...
- std::string::insert函数
string& insert (size_t pos, const string& str); string& insert (size_t pos, const string ...