1.mariaDb

vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos5-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
#如果服务器已经安装了MariaDB-Galera-server包,你可能需要在安装MariaDB-server之前先删除它。(使用sudo yum remove MariaDB-Galera-server),删除MariaDB-Galera-#server的rpm包不会删除任何数据库,但任何升级都应该先备份。
sudo yum install MariaDB-server MariaDB-client
#启动MariaDB
sudo /etc/init.d/mysql start

通过在创建MariaDB.repo,可以实现yum安装

对应不同linux版本配置文件,和详细方法可以参考下面链接

https://mariadb.com/kb/zh-cn/installing-mariadb-with-yum/

https://downloads.mariadb.org/mariadb/repositories/#mirror=opencas

2.nginx

#此命令可以一键安装开发工具包
yum -y groupinstall "Development Tools" "Development Libraries"
#安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装。)
yum -y install pcre*
yum -y install openssl*
#创建www组与www用户
groupadd www
useradd -g www -s /usr/sbin/nologin www
#安装Nginx
tar zxvf nginx-1.9.9.tar.gz
cd nginx-1.9.9.tar.gz/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
#启动Nginx
/usr/local/nginx/sbin/nginx
#测试配置文件是否正确
/usr/local/nginx/sbin/nginx -t

还可以通过service命令来操作nginx服务,如下

1.先创建一个文件,里面写入以下shell脚本如:

进入编辑模式并复制以下内容:查看nginx.shell文件

#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
#
# chkconfig: -
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid RETVAL=
prog="nginx" # Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ ${NETWORKING} = "no" ] && exit [ -x $nginxd ] || exit # Start nginx daemons functions.
start() { if [ -e $nginx_pid ];then
echo "nginx already running...."
exit
fi echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = ] && touch /var/lock/subsys/nginx
return $RETVAL } # Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
} # reload nginx service functions.
reload() { echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo } # See how we were called.
case "$1" in
start)
start
;; stop)
stop
;; reload)
reload
;; restart)
stop
start
;; status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit
esac exit $RETVAL

2.把这个文件复制到/etc/init.d目录下

#cp ./nginx /etc/init.d

3.修改这个文件为可执行的权限

#chmod +x /etc/init.d/nginx

4.把这个可执行文件加到服务服务中去

#chkconfig --add nginx

之后就可以使用 service 命令来管理了!

3.php

#安装前先更新所需要的模块
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel
wget http://cn2.php.net/get/php-7.0.4.tar.gz/from/this/mirror
tar -zxvf php-7.0.4.tar.gz
cd php-7.0.4.tar.gz
./configure --prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip # 编译安装
make && make install # 配置文件
cp php.ini-development /usr/local/php/lib/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 -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm # 启动
/etc/init.d/php-fpm # 查看是否启动
ps aux | grep php

修改nginx配置,监听*.php的文件

# vim /usr/local/nginx/conf/nginx.conf

简单配置如下:

user  www www;

worker_processes ;

#error_log  /data/logs/nginx_error.log  crit;

#pid        logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile ; events
{
use epoll; worker_connections ;
} http
{
include mime.types;
default_type application/octet-stream; #charset gbk; server_names_hash_bucket_size ;
client_header_buffer_size 32k;
large_client_header_buffers 32k;
#client_max_body_size 8m; server_tokens off; expires 1h; sendfile on;
tcp_nopush on;
keepalive_timeout ;
tcp_nodelay on; error_page /.jpg; fastcgi_connect_timeout ;
fastcgi_send_timeout ;
fastcgi_read_timeout ;
fastcgi_buffer_size 256k;
fastcgi_buffers 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_temp_path /dev/shm; gzip on;
gzip_min_length ;
gzip_buffers 16k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/xml application/x-javascript ; log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for'; server {
listen ;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm index.php;
} #rewrite index.php/^(.*)$ idex.php?s=/$ last ; #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$
{
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi.conf;
}
} ################# include ################### # include block_ips.conf ;
# include vhost/*.conf ; #强制域名访问对应域名的conf
# server {
# listen 80 default ;
# server_name _;
# return 404;
# }
}

最后phpinfo(),成功

Centos 6.5 搭建php环境(nginx+mariadb+php7)的更多相关文章

  1. centos7.2环境yum方式快速搭建lnmp环境nginx+mariadb+php-fpm

    centos7.2环境yum方式安装nginx+mariadb+php-fpm 1.安装lnmp环境 安装epel源 yum install -y epel-release 安装 MySQL + PH ...

  2. 基于CentOS与VmwareStation10搭建hadoop环境

    基于CentOS与VmwareStation10搭建hadoop环境     目 录 1. 概述.... 1 1.1. 软件准备.... 1 1.2. 硬件准备.... 1 2. 安装与配置虚拟机.. ...

  3. CentOS 7 上搭建LNMP环境

    (转自美团云知识库Chris) 简介 LNMP是Linux.Nginx.MySQL(MariaDB)和PHP的缩写,这个组合是最常见的WEB服务器的运行环境之一.本文将带领大家在CentOS 7操作系 ...

  4. CentOS下编译搭建LAMP环境

    搭建LAMP环境须知 搭建LAMP环境时,需要安装的所有软件都要按照一定的顺序安装,我们按照Apache->MySQL->PHP的顺序安装.但是在安装PHP之前,应先安装PHP5需要的最新 ...

  5. centos 6.5搭建LNMP环境

    1:查看环境: 1 2 [root@10-4-14-168 html]# cat /etc/redhat-release CentOS release 6.5 (Final) 2:关掉防火墙 1 [r ...

  6. 烂泥:学习centos之快速搭建LNMP环境

    本文由秀依林枫提供友情赞助,首发于烂泥行天下 以前在centos下安装软件都是喜欢源码安装,不过昨天因为一个事情需要一个centos 下的LNMP环境.反倒不会搞了,今天特意记录下,以备后续使用. 一 ...

  7. 使用CentOS Linux Bridge搭建Vxlan环境

    一. 基础环境使用VmWare虚拟两台Linux机器.CentOS 7,Linux内核如下:4.5.3-1.el7.elrepo.x86_64如果内核版本太低,是不支持VxLan的.可以使用一下命令进 ...

  8. CentOS 6.5 搭建 .NET 环境, Mono 5.16.0 + Jexus 5.8

    最近有这样一个打算,就是准备把以前的有一个.NET 网站部署在Linux 下面,正好试试 .NET 跨平台的功能,为后续研究 .netCore 方向准备. 搭建环境: CentOS 6.5 + Mon ...

  9. CentOS 7上搭建Docker环境

    一.Docker介绍和安装 http://linux.cn/article-4340-1.html Docker 是一个开源工具,它可以让创建和管理 Linux 容器变得简单.容器就像是轻量级的虚拟机 ...

随机推荐

  1. LED驅動芯片最大特點

    最大特點是: 1.電源電壓在很寬的範圍內工作時,(約180V-265V)能保證 LED的恒功率輸出,並且 LED可實現無頻閃輸出. 2.實現安全隔離的安全電壓輸出,甚至是安全超低電壓輸出. 3.IC2 ...

  2. POJ3687 Labeling Balls(拓扑)

    题目链接. 题目大意: N个球,从1-N编号,质量不同,范围1-N,无重复.给出小球间的质量关系(<), 要求给每个球贴标签,标签表示每个球的质量.按编号输出每个球的标签.如果解不唯一,按编号小 ...

  3. Xamarin Crack

    Inspired by http://www.cnblogs.com/portal/p/4666252.html#undefined To 'crack' VS Xamarin, take VS201 ...

  4. 线性表(gcc实现)

    线性结构: ①存在一个唯一的被称为“第一个”的数据元素: ②存在一个唯一的被称为“最后一个”的数据元素: ③除第一个元素外,每个元素均有唯一一个直接前驱: ④除最后一个元素外,每个元素均有唯一一个直接 ...

  5. Java实现文件的预览

    最近项目需要用到文件的预览功能,就开始在网上收集资料,学习了几种文件预览的方法.我集成到我项目内测试的有以下三种,最后使用的是第三种: 直接使用别人提供的服务 例如:office web 365 使用 ...

  6. 利用golang语法检查对象是否实现了接口

    var _ ipc.Server = &CenterServer{} CenterServer是否实现了 ipc.Server的接口.编译期间检测,这是很好的编程实践. 稍后详述...

  7. heap(堆)和stack(栈)的区别

    heap是堆,stack是栈 stack的空间由操作系统自动分配/释放,heap上的空间手动分配/释放. stack空间有限,heap是很大的自由存储区 C中的malloc函数分配的内存空间即在hea ...

  8. 跟Google学习Android开发-起始篇-用碎片构建一个动态的用户界面(3)

    4.3 构建一个灵活的用户界面 当设计你的应用程序要支持大范围的屏幕尺寸时,你可以在不同的布局配置中重用碎片,来根据可用的屏幕空间优化用户体验. 例如,在手持设备上,它可能是适应来在一个单窗格用户界面 ...

  9. Android dp和px之间转换 及 获取坐标

    dp.px.sp转换 public class DensityUtil { /** * 将px值转换为dip或dp值,保证尺寸大小不变 * * @param pxValue * @param scal ...

  10. python network programming tutorial

    关于网络编程以及socket 等一些概念和函数介绍就不再重复了,这里示例性用python 编写客户端和服务器端. 一.最简单的客户端流程: 1. Create a socket 2. Connect ...