日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

centos 编译nginx php mariadb,centos7安装nginx+mariadb+php-fpm

發(fā)布時間:2024/4/17 php 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos 编译nginx php mariadb,centos7安装nginx+mariadb+php-fpm 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

由?dp7f1f9f?創(chuàng)建,最后一次修改?2017-05-22

用CentOS-7-x86_64-Minimal-1611.iso最小化安裝一個centos7,安裝選項:英文、時區(qū)為上海、啟用網(wǎng)絡(luò)(如果不在安裝時設(shè)置,需要安裝完成后修改/etc/sysconfig/network-scripts/ifcfg-enp12s0文件中的ONBOOT選項為yes)。安裝完成后,先升級一下整個系統(tǒng):yum?update

重啟:

reboot

列出內(nèi)核,如:

#?rpm?-qa|grep?kernelkernel-3.10.0-514.10.2.el7.x86_64kernel-tools-libs-3.10.0-514.16.1.el7.x86_64kernel-3.10.0-514.16.1.el7.x86_64kernel-tools-3.10.0-514.16.1.el7.x86_64kernel-headers-3.10.0-514.16.1.el7.x86_64

刪除舊內(nèi)核:

yum?remove?kernel-3.10.0-514.10.2.el7.x86_64

安裝一些基本工具(不建議安裝net-tools來使用ifconfig命令,試試ip命令!):

yum?install?wget?unzip?unrar?-y

做完以上工作后,下面是用yum安裝nginx+mariadb+php-fpm的具體過程:

1、添加nginx官方源:rpm?-Uvh?http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2、安裝lnmp基本環(huán)境(如需要其他php組件,另行安裝):

yum?install?nginx?php-fpm?php-gd?php-mysql?mariadb-server?-y

3、設(shè)置mariadb的root密碼:

systemctl?start?mariadbmysqladmin?-u?root?password?"密碼"

4、創(chuàng)建php的session目錄及設(shè)置權(quán)限

mkdir?/var/lib/php/sessionchmod?777?/var/lib/php/session?-R

5、修改nginx配置添加php默認文件:

vi?/etc/nginx/nginx.conflocation?/?{??root?/usr/share/nginx/html;??index?index.php?index.html?index.htm;}

修改以下代碼,添加php支持:#?location?~?.php$?{#???root?html;#???fastcgi_pass?127.0.0.1:9000;#???fastcgi_index?index.php;#???fastcgi_param?SCRIPT_FILENAME?/usr/share/nginx/html$fastcgi_script_name;#???include?fastcgi_params;#?}

刪除上面所有的#和藍色字體部分。

6、防火墻中打開http服務(wù)

由于centos7默認使用的是firewalld防火墻,不再是iptables,許多人不習慣,把默認的卸載,重新安裝了iptables,不建議這樣做,firewalld功能更強大,使用也簡單。防火墻中把http服務(wù)放行設(shè)置如下(配置文件:/etc/firewalld/zones/public.xml):firewall-cmd?--permanent?--zone=public?--add-service=httpfirewall-cmd?--reload

7、啟動lnmp環(huán)境及設(shè)置開機啟動systemctl?start?nginxsystemctl?start?php-fpmsystemctl?enable?nginxsystemctl?enable?php-fpmsystemctl?enable?mariadb

完成!寫個phpinfo測試一下就可以了。

總結(jié)

以上是生活随笔為你收集整理的centos 编译nginx php mariadb,centos7安装nginx+mariadb+php-fpm的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。