LANMP框架搭建——源码编译

所需要的源码包:

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:

[[email protected] ~]# yum -y remove mariadb*

[[email protected] ~]# tar xf mariadb-5.5.46-linux-x86_64.tar.gz -C /usr/local/

[[email protected] ~]# cd /usr/local/

[[email protected] local]# ln -sv mariadb-5.5.46-linux-x86_64 mysql ‘mysql’ -> ‘mariadb-5.5.46-linux-x86_64’

[[email protected] local]# id mysql

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

[[email protected] local]# cd mysql/

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

[[email protected] mysql]# mkdir /mydata/data -p

[[email protected] mysql]# chown -R mysql.mysql /mydata/data/

[[email protected] mysql]# cp support-files/my-large.cnf  /etc/my.cnf

[[email protected] mysql]# vim /etc/my.cnf

添加:

datadir = /mydata/data

skip_name_resolve = ON

innodb_file_per_table = ON

[[email protected] mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

[[email protected] mysql]# chkconfig --add mysqld

[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data

[[email protected] mysql]# ls /mydata/data/

aria_log.00000001 mysqlmysql-bin.000002 performance_schema

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

[[email protected] mysql]# service mysqld start

Starting MySQL.. SUCCESS!

[[email protected] 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:::*

[[email protected] mysql]# vim /etc/profile.d/mysql.sh                              ——命令调用

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

[[email protected] mysql]# chmod +x /etc/profile.d/mysql.sh

[[email protected] mysql]# vim /etc/lb.so.conf.d/mysql.conf                      ——配置mysql的库

/usr/local/bin/lib

[[email protected] mysql]# lbconfig

编译apache:

[[email protected] ~]# yum groupinstall "Development Tools" "Server Platform Development" -y

[[email protected] ~]# yum -y install pcre-devel openssl-devel zlib-devel

[[email protected] ~]# tar xf httpd-2.4.9.tar.bz2

[[email protected] ~]# cd httpd-2.4.9/

[[email protected] httpd-2.4.9]# yum -y install apr-devel apr-util-devel

[[email protected] 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

[[email protected] httpd-2.4.9]# make -j 4 && make install

[[email protected] profile.d]# cat /etc/profile.d/http24.sh

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

[[email protected] apache24]# . /etc/profile.d/httpd24.sh

编译php:

[[email protected] ~]# yum -y install libxml2-devel libmcrypt-devel bzip2-devel

[[email protected] ~]# tar xf php-5.4.26.tar.bz2

[[email protected] ~]# cd php-5.4.26/

[[email protected] 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

[[email protected] php-5.4.26]# make && make install

配置apache与php映射:

[[email protected] php-5.4.26]# cp /root/php-5.4.26/php.ini-production /etc/php.ini

[[email protected] php-5.4.26]# cd /etc/httpd24/

[[email protected] httpd24]# cp httpd.conf{,.backup}

[[email protected] httpd24]# vim httpd.conf

添加:

AddType application/x-httpd-php .php

DirectoryIndex index.php index.html

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

[[email protected] httpd24]# apachectl stop

[[email protected] httpd24]# apachectl start

[[email protected] httpd24]# vim /usr/local/apache24/htdocs/index.php

[[email protected] httpd24]# rm /usr/local/apache24/htdocs/index.html

[[email protected] httpd24]# firefox http://localhost:808

编译nginx:

[[email protected] ~]# tar xf nginx-1.8.1.tar.gz

[[email protected] 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

[[email protected] nginx-1.8.1]# make && make install

[[email protected] nginx-1.8.1]# useradd nginx

[email protected] nginx]# vim /etc/profile.d/nginx.sh

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

[[email protected] nginx]# .  /etc/profile.d/nginx.sh

[[email protected] nginx]# nginx -t

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

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

[[email protected] 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

[[email protected] html]# nginx                                                             ——启动nginx

配置nginx:

[[email protected] 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;
}

时间: 2024-11-10 13:31:30

LANMP框架搭建——源码编译的相关文章

源码编译搭建LAMP环境 

源码编译搭建LAMP环境  一.将 LAMP 相关软件包上传刡 linux 上 [[email protected] ~]# ls anaconda-ks.cfg      install.log         mysql-5.5.30.tar.gz  公共的  视频  文档  音乐 httpd-2.2.25.tar.gz  install.log.syslog  php-5.4.14.tar.bz2   模板    图片  下载  桌面 1. 安装apache [[email protect

CentOS6.5下搭建LAMP环境(源码编译方式)

CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL) 学习PHP脚本编程语言之前,必须先搭建并熟悉开发环境,开发环境有很多种,例如LAMP ,WAMP,MAMP等.这里我介绍一下LAMP环境的搭建,即Linux. Apache. MySQL .PHP环境. 一.首先安装操作系统 操作系统:centos6.5 操作系统安装步骤,此处不再详述. 备注:服务器系统采用最小化安装,安装一下GCC编译工具和一个桌面即可.如下图所示: 由于安装系统的时候我是最小化安装,只安装了一

实战从源码编译LAMP架构+Discuz搭建bbs论坛

实验环境:RHEL6.5  server1.example.com 172.25.254.1 实验环境:RHEL6.5 实验内容:1.MYSQL源码编译                 2.NGINX源码编译                 3.PHP源码编译                 4.搭建论坛 安装包:cmake-2.8.12.2-4.el6.x86_64.rpm               mysql-boost-5.7.11.tar.gz              gd-deve

源码编译搭建LAMP架构

前述: 本次源码编译安装LAMP平台架构在一台CentOs 7虚拟机完成(穿插叙述叙述mariadb在另一台主机上配置方法),php5以模块形式编译安装到httpd服务器上,httpd服务器Apace多路处理模块(MPM)采用prefork机制. 下面为安装所用的的以下软件叙述: CentOS  7 IP:172.16.49.2:Kernel:3.10.0-229.el7.x86_64 MariaDB 通用二进制格式mariadb-5.5.46-linux-x86_64.tar httpd 编译

Win7 32bit下hadoop2.5.1源码编译与平台搭建中遇到的各种错误

本文从一个小白在安装hadoop遇到的各种困难和错误说起,也希望得到大神的指点. 首先hadoop更新很快,最新的是hadoop2.5.1,因此就介绍下在安装2.5.1时遇到的各种困难. 如果直接准备在系统上安装binary版本的,可以参考http://www.cnblogs.com/kinglau/p/3270160.html.在下载好hadoop文件时,一定要注意下载的hadoop版本是否与本机的系统版本相对应,如32bit的还是64bit的,否则在执行start-all.sh时会报错.我就

源码编译安装分离式LAMP平台

前言: LAMP是指:Linux(操作系统),Apache(Web服务器),MySQL/MariaDB(数据库),PHP/Perl/Python(脚本语言),所有组成产品各自独立的开源软件,组合在一起使用,就组成了目前互联网中流行的Web框架:与Java/J2EE架构相比,LAMP具有Web资源丰富,轻量,开发快速等特点,与微软的.NET架构相比,LAMP具有通用.跨平台.高性能.低价格的优势,因此LAMP无论是性能.质量还是价格都是企业搭建网站的首选平台. 工作原理: 分离式的LAMP架构,A

详解LAMP源码编译安装

实战:LAMP源码编译安装 家住海边喜欢浪:zhang789.blog.51cto.com 目录 详解LAMP源码编译安装 LAMP简介 一.准备工作 二.编译安装 Apache 三.编译安装 MySQL 四.编译安装 PHP 测试LAMP搭建开源数据web管理程序phpMyadmin 详解LAMP源码编译安装 LAMP简介 LAMP是当下非常流行的一套Web架构,我们可以在GNU/Linux下通过其他人打包的程序包来进行安装; 但是在生产环境中,很多时候都需要我们自己定制安装AMP,编译安装L

LAMP纯源码编译安装日志

一.LAMP构架的安装与经验技巧(源码安装好处.是便于管理,可以选定参数,可以使用新版本) 相关软件列表: # ls /soft/ | grep -E "*.gz|*.zip|*.xz|*.bz2"    apr-1.4.5.tar.gz    apr-util-1.3.12.tar.gz    autoconf-2.61.tar.gz    freetype-2.3.12.tar.gz    httpd-2.4.18.tar.bz2    jpegsrc.v6b.tar.gz    

源码编译绕过反调试

参考师弟的贴子修改的, 基本我一次就弄好了, 没有遇到啥问题, 下面我主要是补充下他的帖子 http://bbs.pediy.com/showthread.php?t=213481 一. 环境搭建 (1). 环境介绍: 手机:nexus 5 ubuntu版本:15.10 android版本:4.4.4 android源码官网(这里有很多相关的资料,基本上按照官网的来就可以编译想编译的任何版本了) http://source.android.com/source/ (2). 环境配置 配置环境得好