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.pswp.cn/news/373876.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/373876.shtml
英文地址,請注明出處:http://en.pswp.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;并…