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: - 85 15
# 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.confnginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pidRETVAL=0
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 0[ -x $nginxd ] || exit 0# Start nginx daemons functions.
start() {if [ -e $nginx_pid ];thenecho "nginx already running...."exit 1
fiecho -n $"Starting $prog: "daemon $nginxd -c ${nginx_config}RETVAL=$?echo[ $RETVAL = 0 ] && touch /var/lock/subsys/nginxreturn $RETVAL}# Stop nginx daemons functions.
stop() {echo -n $"Stopping $prog: "killproc $nginxdRETVAL=$?echo[ $RETVAL = 0 ] && 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 -HUPRETVAL=$?echo}# See how we were called.
case "$1" in
start)start;;stop)stop;;reload)reload;;restart)stopstart;;status)status $progRETVAL=$?;;
*)echo $"Usage: $prog {start|stop|restart|reload|status|help}"exit 1
esacexit $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 10;#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 51200;events
{use epoll;worker_connections 51200;
}http
{include       mime.types;default_type  application/octet-stream;#charset  gbk;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;#client_max_body_size 8m;server_tokens off;expires       1h; sendfile on;tcp_nopush     on;keepalive_timeout 60;tcp_nodelay on;error_page   404  /404.jpg;fastcgi_connect_timeout 20;fastcgi_send_timeout 30;fastcgi_read_timeout 120;fastcgi_buffer_size 256k;fastcgi_buffers 8 256k;fastcgi_busy_buffers_size 256k;fastcgi_temp_file_write_size 256k;fastcgi_temp_path /dev/shm;gzip on;gzip_min_length  2048;gzip_buffers     4 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       80;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=/$1 last ;#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}
location ~ \.php${fastcgi_pass  127.0.0.1:9000;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(),成功

 

 

转载于:https://www.cnblogs.com/zsj-zhangshijing/p/5089933.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/373876.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MAC itunes无法验证服务器s.mzstatic/itunes无法更新服务器解决方案

打开host文件: 一、用终端打开: sudo vi /etc/hosts 输入完这行命令后需要输入电脑密码,然后确认,进入host文件 然后按i键进入编辑模式,在最后一行添加:23.214.233.166 s.mzstatic.com 如下图 添加完后&…

硬币问题——固定终点的最长路和最短路

问题描述&#xff1a; 有n种硬币&#xff0c;面值分别为V1,V2...,Vn,每种都有无限多。给定非负整数S&#xff0c;可以选用多少个硬币&#xff0c;使得面值之和恰好为S&#xff1f;输出硬币数目的最小值和最大值。0 < n < 100, 0 < S < 10000, 1 < Vi < S。 …

读取nas_NAS怎么玩?除了存放小姐姐,它竟然还有这些功能

自从有了电脑&#xff0c;就一直在折腾"存储那点事儿"&#xff0c;说到底&#xff0c;电脑的本质就是存储&#xff0c;而自己弄家用存储方面的东西算下来也有几年了。单机的硬盘存储比较简单&#xff0c;但是随着家里各种设备的增多&#xff0c;各个设备间的文件共享…

ZK Web框架思想

我曾多次被要求提出一些有关ZK的意见。 因此&#xff0c;根据我作为ZK用户4年的经验&#xff0c;以下是一些想法&#xff1a; 总体开发人员经验&#xff0c;社区和文档 “就是这样” ZK提供的大多数东西都能很好地工作&#xff0c;并且如果您以前开发过任何桌面Java应用程序&…

OC第一讲:类和对象

今天终于开始进行OC的学习了 一.首先讲了NSLog NSLog是oc里面的输出语句&#xff0c;其用法和printf差不多&#xff0c;但是还是有差别的 1&#xff0c;NSLog是自动换行的&#xff0c;不用像printf那样还需要加\n&#xff1b; 2&#xff0c;NSLog在引号面前需要添加符号&#x…

【转载】关于 Google Chrome 中的全屏模式和 APP 模式

【来源于】新浪微博&#xff1a;阿博 http://www.cnblogs.com/abel/p/3235839.html 全屏模式&#xff1a;kiosk 默认全屏打开一个网页呢&#xff0c;只需要在快捷方式中加上 --kiosk [url] 就可以了。 关于全屏模式&#xff1a; 1、全屏模式下&#xff0c;广告插件&#xff08;…

PL/SQL Developer跑在Oracle 64位数据库上初始化错误

安装完Oracle(64位)、PL/SQL Developer后运行PL/SQL出现如下的错误&#xff1a; 网上查资料说&#xff0c;我的PL/SQL Developer与ORACLE不兼容&#xff0c;即PL/SQL不支持64位的ORACLE&#xff0c;因此得下一个32位的ORCALE客户端并配置相应的参数&#xff1a; 解决步骤小记&a…

gis 联合 融合_GIS技术进化 | 我们为何需要跨平台GIS技术体系?

10月30日&#xff0c;超图在2019 GIS 软件技术大会上发布了SuperMap GIS 10i系列产品。SuperMap GIS 10i全面融入人工智能(AI)技术&#xff0c;创新并构建了GIS基础软件“BitCC”五大技术体系&#xff0c;即大数据GIS、人工智能GIS、新一代三维GIS、云原生GIS和跨平台GIS&#…

Spring陷阱:代理

作为Spring框架的用户和发烧友多年&#xff0c;我遇到了一些关于此堆栈的误解和问题。 另外&#xff0c;在某些地方抽象非常可怕地泄漏&#xff0c;以便有效&#xff0c;安全地利用开发人员需要意识到的所有功能。 这就是为什么我开始Spring陷阱系列的原因。 在第一部分中&…

UVa11925 Generating Premutations

留坑(p.254) 1 #include<cstdio>2 #include<cstring>3 #include<cstdlib>4 #include<algorithm>5 #include<iostream>6 7 using namespace std;8 9 void setIO(const string& s) { 10 freopen((s ".in").c_str(), "r&qu…

xamarin UWP中MessageDialog与ContentDialog的区别

MessageDialog与ContentDialog的异同点解析&#xff1a; 相同点一&#xff1a;都是uwp应用上的一个弹窗控件。都能做为弹出应用。 相异点一&#xff1a;所在命名空间不同&#xff0c;MessageDialog在Windows.UI.Popups.MessageDialog下&#xff0c;而ContentDialog在Windows.UI…

python筛选大量数据_python(数据筛选)

在Python3中&#xff1a;(1)xrange的功能合并到range里面&#xff0c;xrange已经不存在 -> range和xrange用法(2)filter已经不能返回一个list&#xff0c;而是只能返回一个迭代对象&#xff0c;需要套在一个list()里面&#xff0c;且&#xff0c;需要注意的是&#xff0c;fi…

ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务

不指定数据库可以正常连接&#xff1a; 指定数据库和使用PL/SQL Developer都出现错误&#xff1a; 在此说明一下我的环境&#xff1a;Oralce装的是64位的在使用PL/SQL Developer时曾出现过初始化错误&#xff0c;解决办法就是下载oracle 32位客户端并相应的配置。 解决方案一&a…

Devoxx 2011印象

Devoxx 2011结束了&#xff0c;它很棒。 最终&#xff0c;在不得不与妻子和孩子度过周末之后&#xff08;上个星期我很少见过&#xff09;&#xff0c;我找到了写下一些东西的时间。 对我来说&#xff0c;这是第六个Devoxx&#xff0c;我的第一个是2006年-那时我还是一个学生&a…

Ubuntu14.04.3,apt-get出现dpkg: error processing package xxx (--configure)和cups-daemon错误的解决方案...

Ubuntu14.04.3&#xff0c;使用apt-get安装软件的时候&#xff0c;报个莫名其妙的错误&#xff1a; dpkg: error processing package xxx (--configure): balabala...Errors were encountered while processing: cups-daemon cups-core-drivers cups E: Sub-process /usr/bin/d…

实验三 类的继承和多态性

实验三 类的继承和多态性 1.(1)编写一个接口ShapePara&#xff0c;要求&#xff1a; 接口中的方法&#xff1a; int getArea()&#xff1a;获得图形的面积。int getCircumference()&#xff1a;获得图形的周长 (2)编写一个圆类Circle&#xff0c;要求&#xff1a;圆类Circle实现…

ORA-01843:无效的月份

Oracle数据库默认情况下&#xff0c;会以DD-MON-YY的形式显示日期&#xff0c;其中DD是天数&#xff0c;MON是月份的前三个字母&#xff08;大写&#xff09;&#xff0c;而YY是年份的最后两位。数据库实际上会为年份存储4位数字&#xff0c;但是默认情况下只会显示最后两位。 …

贪心策略取得最优解的条件_什么是贪心算法?

一、什么是贪心算法贪心算法是指&#xff0c;在对问题求解时&#xff0c;总是做出在当前看来是最好的选择。(局部最优解&#xff0c;而不是整体最优解)贪心算法没有固定的算法框架&#xff0c;算法设计的关键是贪心策略的选择。必须注意的是&#xff0c;贪心算法不是对所有问题…

Devoxx第1天

参加Devoxx给我带来了足够的动力来发布我的第一篇博客文章。 我是第一次来这里&#xff0c;它的组织方式给我留下了深刻的印象。 目前有记录的最高发言人。 对我来说&#xff0c;选择演示文稿来参加是一个问题。 但是感谢组织者&#xff0c;所有活动都将在12月下旬在parleys.co…

Oracle 事务的开始与结束

事务是用来分割数据库活动的逻辑工作单元&#xff0c;事务即有起点&#xff0c;也有终点&#xff1b; 事物的处理就是保证数据操作的完整性&#xff0c;所有的操作要么成功要么同时失败。当下列事件之一发生时&#xff0c;事务就开始了&#xff1a;连接到数据库上&#xff0c;并…