LNMP环境搭建--Centos7 | 刘鹏--博客

盒子

文章目录

在Centos7环境安装LAMP环境,备忘哈哈。

准备

首先去官网下载php,nginx

编译安装php

安装依赖

1
2
yum -y install epel-release
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

编译参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
./configure 
--prefix=/usr/local/php
--with-config-file-path=/etc
--enable-fpm
--with-fpm-user=nginx
--with-fpm-group=nginx
--enable-inline-optimization
--disable-debug
--disable-rpath
--enable-shared
--enable-soap
--with-libxml-dir
--with-xmlrpc
--with-openssl
--with-mcrypt
--with-mhash
--with-pcre-regex
--with-sqlite3
--with-zlib
--enable-bcmath
--with-iconv
--with-bz2
--enable-calendar
--with-curl
--with-cdb
--enable-dom
--enable-exif
--enable-fileinfo
--enable-filter
--with-pcre-dir
--enable-ftp
--with-gd
--with-openssl-dir
--with-jpeg-dir
--with-png-dir
--with-zlib-dir
--with-freetype-dir
--enable-gd-native-ttf
--enable-gd-jis-conv
--with-gettext
--with-gmp
--with-mhash
--enable-json
--enable-mbstring
--enable-mbregex
--enable-mbregex-backtrack
--with-libmbfl
--with-onig
--enable-pdo
--with-mysqli=mysqlnd
--with-pdo-mysql 大专栏  LNMP环境搭建--Centos7=mysqlnd
--with-zlib-dir
--with-pdo-sqlite
--with-readline
--enable-session
--enable-shmop
--enable-simplexml
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-wddx
--with-libxml-dir
--with-xsl
--enable-zip
--enable-mysqlnd-compression-support
--with-pear
--enable-fastcgi
--enable-opcache

安装

make && make install

配置环境变量

1
2
3
4
5
vim /etc/profile
末尾追加
export PATH=/usr/local/php/bin:$PATH
source /etc/profile
php -v #应该能看到php版本信息

配置php-fpm 需要在安装软件包目录

1
2
3
4
5
cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod a+x /etc/init.d/php-fpm

增加用户组和用户

1
2
groupadd nginx
useradd -g nginx nginx

启动php-fpm

/etc/init.d/php-fpm start

开机启动

1
2
3
4
 加入服务
chkconfig --add php-fpm
开机自启
chkconfig php-fpm on

安装nginx

安装依赖

1
yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

编译

1
2
./configer
make && make install

关闭防火墙(可选)

1
2
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

开机启动

脚本

1
2
3
chmod a+x /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on

安装mysql

1
2
3
4
5
6
7
8
# 安装
yum -y install mariadb mariadb-server
启动mariadb
systemctl start mariadb
# 开机自启动
systemctl enable mariadb
# 设置 root密码等相关
mysql_secure_installation

关闭

LNMP环境搭建--Centos7的更多相关文章

  1. lnmp环境搭建:Centos7 + Nginx1.12.2 + Mysql-5.6.38 + PHP7.2.0

    https://blog.csdn.net/ty_hf/article/details/50622888

  2. 阿里云(ECS)Centos服务器LNMP环境搭建

    阿里云( ECS ) Centos7 服务器 LNMP 环境搭建 前言 第一次接触阿里云是大四的时候,当时在校外公司做兼职,关于智能家居项目的,话说当时俺就只有一个月左右的 php 后台开发经验(还是 ...

  3. LNMP环境搭建哈哈

    经过一番折腾,终于将LNMP环境搭建完成了.本文介绍的LNMP环境是在windows的Oracle VM VirtualBox中的Centos虚拟机上搭建的,各个软件的版本为:Centos7 + Ng ...

  4. zabbix学习(一)——LNMP环境搭建及zabbix安装

    第一部分:LNMP环境搭建 一.环境说明: OS:   centos7.6_x64nginx:nginx-1.16.0php:   php-7.1.11mysql:mysql-5.6.44 zabbi ...

  5. LNMP环境搭建

    LNMP环境搭建 Linux + Nginx + MySQL + PHP PHP是一种脚本语言,当前中国乃至世界上使用PHP语言开发的网站非常普遍 Nginx是一个web服务软件,和apache是一类 ...

  6. LNMP环境搭建:Nginx安装、测试与域名配置

    Nginx作为一款优秀的Web Server软件同时也是一款优秀的负载均衡或前端反向代理.缓存服务软件 2.编译安装Nginx (1)安装Nginx依赖函数库pcre pcre为“perl兼容正则表达 ...

  7. LNMP环境搭建——MySQL篇

    The world's most popular open source database 1.Install MySQL root@kallen:~# apt-get install mysql-s ...

  8. LNMP环境搭建之php安装,wordpress博客搭建

    LNMP环境搭建之php安装,wordpress博客搭建 一.介绍: 1.什么是CGI CGI全称是"通用网关接口"(Common Gateway Interface),HTTP服 ...

  9. Ubuntu16.04 lnmp 环境搭建

    Ubuntu16.04 lnmp 环境搭建 nginx 安装 sudo apt-add-repository ppa:nginx/stablesudo apt-add-repository ppa:o ...

随机推荐

  1. 架构之道(5) - APP和Web的后台架构

    当一个项目,同时需要Web.手机H5.Android,三平台同时可以测览,那就需要很简洁而有力的架构. 而我这就经历了这麽一个项目,先开发网站,然后是手机H5,最后是Android. 自信男人,无须多 ...

  2. 解决IntelliJ IDEA Community 社区版 启动Tomcat插件 "Smart Tomcat" NullPointerException 空指针异常

    IntelliJ IDEA Community社区版默认是没有Ultimate版的Tomcat Server,这时候就可以使用插件"Smart Tomcat"; 在"Ru ...

  3. Entity Framework实现属性映射约定

    Entity Framework Code First属性映射约定中“约定”一词,在原文版中为“Convention”,翻译成约定或许有些不好理解,这也是网上比较大多数的翻译,我们就当这是Entity ...

  4. PAT甲级——1035 Password (20分)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  5. tesseract系列(4) -- tesseract训练问题总结

    1. 每次训练模型删除目录下,上述重复的名字 2. 生成inttemp.pffmtable文件的时候,如果下述命令(1)不行的话,或者报错,使用命令(2) (1)mftraining -F font_ ...

  6. [WC2015]未来程序(提交答案)

    sub1:ans=a*b%c,龟速乘即可. #include <stdio.h> #include <stdlib.h> unsigned long long a, b, c, ...

  7. springboot-security 登录 403

    之前一直使用shiro,刚开始使用security,大佬还请不要吐槽 security默认开启csrf防护,所谓csrf也就是伪请求.我们只需要把他关闭就好(因为我们的系统是在自己内网使用,不会有外部 ...

  8. rework-发出你的心声

    生意人虚张声势的时候会给人什么感觉?都是些僵硬的措辞.官方的腔调.虚伪的友善.法律术语等.你一定看过这些玩意儿,就好像是机器人写出来的东西,这些公司在向你发话,而不是和你对话. 这种专业主义面具让人觉 ...

  9. 47)PHP,数据库多表连接

    https://www.w3cschool.cn/mysql/56ik1sqv.html

  10. 以puppeteer抓取微指数,puppeteer基本示例,docker部署headless

    还是直接上代码 https://github.com/cclient/weizhishu-puppeteer 根据关键字获取微博指数 早期版本以常规的构造cookie,token,sign的访问api ...