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++环境编译. 方法一:根据错误提示去对应 ...
随机推荐
- Python批量修改文件名模板
源码如下:import os import re import sys filePath = r'F:\BaiduNetdiskDownload\COVID-19CTSeg\3DUNet-Pytorc ...
- Web 环境设置
修改最大打开文件数量 ulimit -n 100000 修改创建文件的最大值 #/etc/security/limits.conf * soft nofile 262140 * hard nofile ...
- 谷歌 MapReduce 初探
谷歌“三驾马车”的出现,才真正把我们带入了大数据时代,毕竟没有谷歌,就没有大数据. 上次的分享,我们对谷歌的其中一驾宝车 GFS 进行了管中窥豹,虽然只见得其中一斑,但是也能清楚的知道 GFS 能够把 ...
- python正则表达式去除文本中间的换行符
例如文本: 在这个活动中,请各位同学做一下自我介绍,也看看别的同学的自我介绍,看看谁的介绍更有个性!也许你能在这里找到志趣相投的学习伙伴.也希望大家能够彼此关注,相互鼓励,共同学习. 你的发帖可以包含 ...
- jmeter发送Query String Parameters格式参数报错
当发起一次GET请求时,参数会以url string的形式进行传递.即?后的字符串则为其请求参数,并以&作为分隔符 当参数为json格式时,这时需要勾选编码,否则会报错
- js中相关的windows方法的使用和location的先关方法的使用
下面是关于windows的相关方法的简单介绍. setInterval():它有一个返回值,主要是提供给clearInterval使用. setTimeout():它有一个返回值,主要是提供给clea ...
- openpyxl 模块 读写Excel
import openpyxl #写到execl中def write_execl(): book=openpyxl.Workbook() sheet=book.active #获取默认sheet # ...
- mappedBy和JoinColumn,onetomany。
无论是onetomany,还是manytoone.都要设置级联关系(cascade),否则不会储存关联的数据. @Entity public class Clazzss { @Id @Generate ...
- zookeeper的下载安装和选举机制(zookeeper一)
1. 简要概述 Zookeeper是一个开源的分布式的,为分布式应用提供协调服务的框架.Zookeeper从设计模式角度来理解:是一个基于观察者模式设计的分布式服务管理框架它负责存储和管理大家都关心的 ...
- MODIS系列之NDVI(MOD13Q1)四:MRT单次及批次处理数据
前言: 本篇文章的出发点是因为之前接触过相关研究,困囧于该系列资料匮乏,想做一个系列.个人道行太浅,不足之处还请见谅.愿与诸君共勉. 数据准备: MODIS数据产品MOD13Q1—以2010年河南省3 ...