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++环境编译. 方法一:根据错误提示去对应 ...
随机推荐
- ArrayList中的Iterator详解
每个实现Iterable接口的类必须提供一个iterator方法,返回一个Iterator对象,ArrayList也不例外 public Iterator<E> iterator() { ...
- 9.Maven的生命周期
Clean Lifecycle: 在进行真正的构建之前进行一些清理工作. Default Lifecycle :构建的核心部分,编译,测试,打包,部署等等. Site Lifecycle : 生成项目 ...
- RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK/Code/IO/src/sitkImageReaderBase.cxx:107: sitk::ERROR: Unable to determine ImageIO reader for "./data/.train.txt.swp"问题解决
原因:产生此类错误是因为SimpleITK不能读取ubuntu中的隐藏文件,比如".train.txt.swp",因为此类文件是隐藏文件另外SimpleITK不支持读取此类文件. ...
- 在linux虚拟机上安装docker并安装mysql
步骤 1.检查内核版本,必须是3.10及以上 uname -r 2.安装docker yum install docker 3.输入y确认安装 4.启动docker systemctl start d ...
- CSS躬行记(3)——CSS属性拾遗
一.粘滞定位 粘滞定位(sticky)与相对定位类似,既不会脱离正常流,也不会改变元素盒类型,并且会保留原先所占的空间.它会相对于包含块偏移,它的包含块分为两种,第一种和绝对定位一样:第二种是最近的滚 ...
- Flutter 完美的验证码输入框
老孟导读:刚开始看到这个功能的时候一定觉得so easy,开始的时候我也是这么觉得的,这还不简单,然而真正写的时候才发现并没有想象的那么简单. 先上图,不上图你们都不想看,我难啊,到Github:ht ...
- 细数Java项目中用过的配置文件(ini 篇)
Java 菜鸟,会把可变的配置信息写死在代码里:Java 老鸟,会把可变的配置信息提取到配置文件中.坊间流传这么一句非科学的衡量标准,来评判程序员的级别. 那么,项目中的配置信息,你平时都是怎样来实现 ...
- 1078 Hashing (25分)
The task of this problem is simple: insert a sequence of distinct positive integers into a hash tabl ...
- 字符串截取及切割,正则表达式,expect预期交互
字符串截取及切割,正则表达式,expect预期交互 案例1:字符串截取及切割 案例2:字符串初值的处理 案例3:expe ...
- CF633(div.2)A. Filling Diamonds
题目描述 http://codeforces.com/contest/1339/problem/A 给定一个 \(n(1\le n \le 10^9)\) ,问用一个由两个三角形组成的菱形,填充下面这 ...