所需要的源码包:

mariadb-5.5.46-linux-x86_64.tar.gz

httpd-2.4.9.tar.bz2

php-5.4.26.tar.bz2

nginx-1.8.1.tar.gz



编译mariadb:

[root@centos7 ~]# yum -y remove mariadb*

[root@centos7 ~]# tar xf mariadb-5.5.46-linux-x86_64.tar.gz -C /usr/local/

[root@centos7 ~]# cd /usr/local/

[root@centos7 local]# ln -sv mariadb-5.5.46-linux-x86_64 mysql ‘mysql’ -> ‘mariadb-5.5.46-linux-x86_64’

[root@centos7 local]# id mysql

uid=27(mysql) gid=27(mysql) groups=27(mysql)

[root@centos7 local]# cd mysql/

[root@centos7 mysql]# chown -R root:mysql ./*       ——链接文件赋权规则

[root@centos7 mysql]# mkdir /mydata/data -p

[root@centos7 mysql]# chown -R mysql.mysql /mydata/data/

[root@centos7 mysql]# cp support-files/my-large.cnf  /etc/my.cnf

[root@centos7 mysql]# vim /etc/my.cnf

添加:

datadir = /mydata/data

skip_name_resolve = ON

innodb_file_per_table = ON

[root@centos7 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

[root@centos7 mysql]# chkconfig --add mysqld

[root@centos7 mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data

[root@centos7 mysql]# ls /mydata/data/

aria_log.00000001 mysqlmysql-bin.000002 performance_schema

aria_log_control mysql-bin.000001 mysql-bin.index test

[root@centos7 mysql]# service mysqld start

Starting MySQL.. SUCCESS!

[root@centos7 mysql]# ss -tnl

StateRecv-Q Send-Q Local Address:PortPeer Address:Port

LISTEN05192.168.122.1:53*:*

LISTEN0128*:22*:*

LISTEN0128127.0.0.1:631*:*

LISTEN0100127.0.0.1:25*:*

LISTEN0128:::22:::*

LISTEN0128::1:631:::*

LISTEN0100::1:25:::*

[root@centos7 mysql]# vim /etc/profile.d/mysql.sh                              ——命令调用

export PATH=/usr/local/mysql/bin:$PATH

[root@centos7 mysql]# chmod +x /etc/profile.d/mysql.sh

[root@centos7 mysql]# vim /etc/lb.so.conf.d/mysql.conf                      ——配置mysql的库

/usr/local/bin/lib

[root@centos7 mysql]# lbconfig

编译apache:

[root@centos7 ~]# yum groupinstall "Development Tools" "Server Platform Development" -y

[root@centos7 ~]# yum -y install pcre-devel openssl-devel zlib-devel

[root@centos7 ~]# tar xf httpd-2.4.9.tar.bz2

[root@centos7 ~]# cd httpd-2.4.9/

[root@centos7 httpd-2.4.9]# yum -y install apr-devel apr-util-devel

[root@centos7 httpd-2.4.9]# ./configure --prefix=/usr/local/apache24 --sysconfdir=/etc/httpd24--enable-so --enable-ssl -- enable-rewrite --with-zlib --with-pcre --with-apr=/usr --with-apr-util=/usr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork

[root@centos7 httpd-2.4.9]# make -j 4 && make install

[root@centos7 profile.d]# cat /etc/profile.d/http24.sh

export PATH=/usr/local/apache24/bin:$PATH

[root@centos7 apache24]# . /etc/profile.d/httpd24.sh

编译php:

[root@centos7 ~]# yum -y install libxml2-devel libmcrypt-devel bzip2-devel

[root@centos7 ~]# tar xf php-5.4.26.tar.bz2

[root@centos7 ~]# cd php-5.4.26/

[root@centos7 php-5.4.26]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2

[root@centos7 php-5.4.26]# make && make install

配置apache与php映射:

[root@centos7 php-5.4.26]# cp /root/php-5.4.26/php.ini-production /etc/php.ini

[root@centos7 php-5.4.26]# cd /etc/httpd24/

[root@centos7 httpd24]# cp httpd.conf{,.backup}

[root@centos7 httpd24]# vim httpd.conf

添加:

AddType application/x-httpd-php .php

DirectoryIndex index.php index.html

Listen  808                                                                     ——修改协议端口(因为这是自己编译的apache)

[root@centos7 httpd24]# apachectl stop

[root@centos7 httpd24]# apachectl start

[root@centos7 httpd24]# vim /usr/local/apache24/htdocs/index.php

[root@centos7 httpd24]# rm /usr/local/apache24/htdocs/index.html

[root@centos7 httpd24]# firefox http://localhost:808

编译nginx:

[root@centos7 ~]# tar xf nginx-1.8.1.tar.gz

[root@centos7 nginx-1.8.1]# ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_gzip_static_module --with-debug --with-http_stub_status_module

[root@centos7 nginx-1.8.1]# make && make install

[root@centos7 nginx-1.8.1]# useradd nginx

root@centos7 nginx]# vim /etc/profile.d/nginx.sh

export PATH=/usr/local/nginx/sbin:$PATH

[root@centos7 nginx]# .  /etc/profile.d/nginx.sh

[root@centos7 nginx]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@centos7 nginx]# nginx -h

nginx version: nginx/1.8.1

Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:

-?,-h: this help

-v: show version and exit

-V: show version and configure options then exit

-t: test configuration and exit

-q: suppress non-error messages during configuration testing

-s signal: send signal to a master process: stop, quit, reopen, reload

-p prefix  : set prefix path (default: /usr/local/nginx/)

-c filename : set configuration file (default: /etc/nginx/nginx.conf)

-g directives : set global directives out of configuration file

[root@centos7 html]# nginx                                                             ——启动nginx

配置nginx:

[root@centos7 html]# vim /etc/nginx/nginx.conf

添加:

upstream lamp {                                                                                ——虚拟主机

server 127.0.0.1:808 weight=1 max_fails=2 fail_timeout=30s;
}

location / {

root  /usr/local/apache24/htdocs ;

index  index.html index.htm index.php;

}

location ~.*\.(php|jsp|cgi)?$                                                                ——动态页面给lamp执行
{
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://lamp;
}

location ~.*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$             ——静态页面自己执行
{
root /usr/local/apache24/htdocs;
expires 3d;
}

转载于:https://blog.51cto.com/zhaom0109/1905959

LANMP框架搭建——源码编译相关推荐

  1. LNMP架构的搭建--源码编译(MYSQL,PHP,nginx)

    1.基础知识 1. LNMP架构: LNMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写.L指Linux,N指Nginx,M一般指MySQL,也可以指MariaDB,P一般指P ...

  2. LNMP架构的搭建——源码编译(PHP,nginx,Mysql)

    一.源码编译 在企业中,我们常常是需要什么模块才会添加什么模块,而源码编译就可以让我们按需安装. yum安装的优缺点: yum安装的优点:安装东西,方便快捷,特别是不用考虑包依赖. yum安装的缺点: ...

  3. lnmp架构搭建—源码编译(nginx、mysql、php)

    含义及理解: LNMP = Linux+Nginx+Mysql+PHP:LNMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写.L指Linux,N指Nginx,M一般指MySQL ...

  4. 干货|TensorFlow开发环境搭建(Ubuntu16.04+GPU+TensorFlow源码编译)

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 本文转自|机器学习算法工程师 安装平台 1 平台 目前Tensor ...

  5. LNMP架构环境搭建之PHP、Nginx源码编译安装及其简单配置应用

    LNMP架构中的Mysql见上一篇博文"LNMP架构环境搭建之mysql源码编译安装" 一.PHP简介 PHP(外文名:PHP: Hypertext Preprocessor,中文 ...

  6. LNMP架构环境搭建之mysql源码编译安装

    Mysql MySQL是一个开源的数据库,在互联网行业应用的很广泛,下面来记录一下从源码编译安装的步骤,当然,MySQL也有其他安装方式,比如,使用yum下载安装rpm包,或者二进制方式安装,如果机器 ...

  7. 小明分享| SigmastarSSD201环境搭建及源码编译

    本文以目前最新版本(TAKOYAKI_DLS00V008)的 SDK 为例,讲述 SigmastarSSD201/202 环境搭建 源码下载 下载 kernel 源码 从 https://mirror ...

  8. Hadoop-2.8.0集群搭建、hadoop源码编译和安装、host配置、ssh免密登录、hadoop配置文件中的参数配置参数总结、hadoop集群测试,安装过程中的常见错误

    25. 集群搭建 25.1 HADOOP集群搭建 25.1.1集群简介 HADOOP集群具体来说包含两个集群:HDFS集群和YARN集群,两者逻辑上分离,但物理上常在一起 HDFS集群: 负责海量数据 ...

  9. FreeCAD v0.19源码编译与VS2017+Qt5环境搭建

    FreeCAD v0.19源码编译与VS2017+Qt5环境搭建_$firecat全宏的代码足迹$-CSDN博客一.环境准备VS2017,x64cmake-3.14.5-win64-x64.msiFr ...

最新文章

  1. 求得到一个字符串@“absdfasdfsdfdsafsd....”所有的排列
  2. [IIS]修改MaxFieldLength与MaxRequestBytes彻底解决Request Too Long的问题
  3. Exception in thread http-bio-80exec-1 java.lang.OutOfMemoryError: PermGen s解决方案
  4. python【力扣LeetCode算法题库】322-零钱兑换(动态规划)
  5. Python 技术篇-通过pip命令下载python库到指定位置不用安装方法,查看pip下载库的源码实例演示,pip命令大全
  6. C++ 使用VS2010创建MFC ActiveX工程项目
  7. windows下springboot项目部署elk日志系统教程elasticsearch与logstash与kibana
  8. 80端口攻击_使用 ZoomEye 寻找 APT 攻击的蛛丝马迹
  9. 灰色系统理论及其应用 (七) :道路交通事故灰色 Verhulst 预测模型
  10. 【python实战】二:乒乓球比赛对手问题
  11. 联通的G网和C网分别是什么意思?
  12. 在JavaScript中使用Octet Streams
  13. mysql sum契合_文化契合者为王。 这是在下一次开发人员面试中如何定位的方法。...
  14. 神经网络模型用于数学建模
  15. GoogleTest系列:TEST_P的基本用法
  16. Windows命令行常用命令
  17. 计算机无法识别华为m3,华为平板M3青春版10.1英寸平板电脑没法充电的原因是什么_华为平板电脑没法充电故障分析...
  18. 全面解析存储加密盘(SED)技术
  19. 怎样分析数据致提高产出?(三)
  20. 洛谷 P3166 [CQOI2014]数三角形(gcd+组合计数)

热门文章

  1. 目标检测--Wide-Residual-Inception Networks for Real-time Object Detection
  2. ClickHouse系列教程七:centos下源码编译安装及报错解决
  3. python setdefault,Python笔记setdefault用法
  4. maven只打包java目录_ssm项目中maven对resources目录打包的路径_默认路径,自定义路径...
  5. 搭建Harbor 2.x仓库 - docker私仓搭建
  6. Elasticsearch之分布式介绍
  7. switch case穿透Java_Switch语句的case穿透
  8. 老大说要自动化测试,我是怎么做的可以看看
  9. Python 测试开发从入门到高手成长之路
  10. Linux文本搜索工具grep