Centos 6.5 搭建php环境(nginx+mariadb+php7)
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)的更多相关文章
- 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 ...
- 基于CentOS与VmwareStation10搭建hadoop环境
基于CentOS与VmwareStation10搭建hadoop环境 目 录 1. 概述.... 1 1.1. 软件准备.... 1 1.2. 硬件准备.... 1 2. 安装与配置虚拟机.. ...
- CentOS 7 上搭建LNMP环境
(转自美团云知识库Chris) 简介 LNMP是Linux.Nginx.MySQL(MariaDB)和PHP的缩写,这个组合是最常见的WEB服务器的运行环境之一.本文将带领大家在CentOS 7操作系 ...
- CentOS下编译搭建LAMP环境
搭建LAMP环境须知 搭建LAMP环境时,需要安装的所有软件都要按照一定的顺序安装,我们按照Apache->MySQL->PHP的顺序安装.但是在安装PHP之前,应先安装PHP5需要的最新 ...
- 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 ...
- 烂泥:学习centos之快速搭建LNMP环境
本文由秀依林枫提供友情赞助,首发于烂泥行天下 以前在centos下安装软件都是喜欢源码安装,不过昨天因为一个事情需要一个centos 下的LNMP环境.反倒不会搞了,今天特意记录下,以备后续使用. 一 ...
- 使用CentOS Linux Bridge搭建Vxlan环境
一. 基础环境使用VmWare虚拟两台Linux机器.CentOS 7,Linux内核如下:4.5.3-1.el7.elrepo.x86_64如果内核版本太低,是不支持VxLan的.可以使用一下命令进 ...
- CentOS 6.5 搭建 .NET 环境, Mono 5.16.0 + Jexus 5.8
最近有这样一个打算,就是准备把以前的有一个.NET 网站部署在Linux 下面,正好试试 .NET 跨平台的功能,为后续研究 .netCore 方向准备. 搭建环境: CentOS 6.5 + Mon ...
- CentOS 7上搭建Docker环境
一.Docker介绍和安装 http://linux.cn/article-4340-1.html Docker 是一个开源工具,它可以让创建和管理 Linux 容器变得简单.容器就像是轻量级的虚拟机 ...
随机推荐
- Niagara解决设备连接应用的软件框架平台技术。
Niagara 是Tridium公司所研发的设计用于解决设备连接应用的软件框架平台技术. Niagara是一种应用框架,或者说是软件框架,特别设计用于应对智能设备所带来的各种挑战,包括设备连接到企业级 ...
- 【转】no resource found @integer/google_play_services_version whats this?
原文网址:http://stackoverflow.com/questions/24325333/no-resource-found-integer-google-play-services-vers ...
- Palindrome Partitioning——LeetCode
Given a string s, partition s such that every substring of the partition is a palindrome. Return all ...
- cppunit学习笔记
下载cppunit 链接:http://www.cnblogs.com/duxiuxing/p/4303809.html cppunit官方文档浅析 链接:http://www.cnblogs.com ...
- WAD Forwarder版USB Loader的安装和运行
背景知识 我使用Wad Manager来安装WAD版软件,所以需要先在Wii上面把Wad Manager准备好.详情可以参考我写的另外一篇文章<Wad Manager的下载和运行>(链接: ...
- iOS图片处理
http://www.cnblogs.com/kenshincui/p/3959951.html
- 我理解的javascript单线程机制
废话不多说,我们先来看几个例子: 1. setTimeout( console.log(2); result: 2 1 2. console.log(100 setTimeout( cons ...
- 百度地图点聚合MarkerClusterer,性能优化
参考文献:http://www.cnblogs.com/lightnull/p/6184867.html 百度的点聚合算法 是基于方格和距离的聚合算法,即开始的时候地图上没有任何已知的聚合点,然后遍历 ...
- 浅谈MVC模式
MVC模式(三层架构模式) (Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Controller ...
- Media层
媒体层包含图形技术.音频技术和视频技术,这些技术相互结合就可为移动设备带来最好的多媒体体验,更重要的是,它们让创建外观音效俱佳的应用程序变得更加容易.您可以使用iOS的高级框架更快速地创建高级的图形和 ...