狠狠躁夜夜躁人人爽天天不卡软件丨成·人免费午夜无码视频丨国产成人无码18禁午夜福利免费丨欧美一区二区婷婷香蕉狠狠干丨色欲国产精品一区二区

技術(shù)文檔

幫助中心 > 技術(shù)文檔 >

Centos7 手動(dòng)安裝nginx+php環(huán)境

2023-12-13 作者:簡米科技 閱讀量:0 所屬分類:技術(shù)文檔

我們以安裝nginx1.8+php7.2版本為例進(jìn)行手動(dòng)安裝,具體安裝流程如下:

一、Nginx安裝:

1、安裝相關(guān)依賴包

yum -y install gcc gcc-c++ autoconf automake make

yum -y install zlib zlib-devel openssl

yum -yinstallopenssl-devel pcre pcre-devel

2、下載nginx安裝包,也可以到nginx官網(wǎng)找到你想要安裝的版本進(jìn)行下載

nginx官網(wǎng)下載:http://nginx.org/download/

1)進(jìn)入目錄: cd /usr/local

2)下載文件: wget http://nginx.org/download/nginx-1.8.0.tar.gz

3)解壓文件: tar -zxvf nginx-1.8.0.tar.gz

4)進(jìn)入解壓后目錄: cd nginx-1.8.0

5)執(zhí)行命令編譯安裝:

. /configure

make make install

3,安裝完成之后在/usr/local文件夾下面會(huì)多出一個(gè)nginx的文件夾

1)進(jìn)入/usr/local/nginx 目錄下:

cd /usr/local/nginx

2)執(zhí)行 ./sbin/nginx #啟動(dòng)nginx服務(wù)

4,將nginx 加入服務(wù)項(xiàng)

1)創(chuàng)建服務(wù)文件:

vi /usr/lib/systemd/system/nginx.service

寫入以下代碼:

[Unit]

Description=nginx - high performance web server

Documentation=http://nginx.org/en/docs/

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

PIDFile=/usr/local/nginx/logs/nginx.pid

ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

ExecReload=/bin/kill -s HUP $MAINPID

ExecStop=/bin/kill -s QUIT $MAINPID

PrivateTmp=true

[Install]

WantedBy=multi-user.target

:wq #保存退出

5,測(cè)試啟動(dòng)服務(wù)

systemctl start nginx.service

6,查看是否啟動(dòng)

ps -ef | grep nginx

7,設(shè)置開機(jī)自啟動(dòng)

systemctl enable nginx.service

到此nginx安裝完成

二、安裝PHP

1,安裝依賴包:

yum install -y gcc gcc-c++ libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel freetype freetype-devel

2,進(jìn)入到/usr/local目錄下,下載php安裝包:

cd /usr/local

wget http://tz1.php.net/distributions/php-7.2.10.tar.gz

也可以進(jìn)入到php官網(wǎng)去下載:http://php.net/downloads.php

3,解壓

tar -zxvf php-7.2.10.tar.gz

4,進(jìn)入解壓出來的php目錄

cd php

注:如果解壓出來的不是php目錄,可以改名,比如解壓出來的目錄為php-7.2 ,需要執(zhí)行mv php-7.2 php ,修改成php

5,編譯php:

編譯:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts -with-mcrypt=/usr/include --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --enable-ftp --enable-session --with-gettext --with-jpeg-dir --with-freetype-dir --enable-fastcgi --without-gdbm --disable-fileinfo

6,安裝php:

make make install

7,安裝完成后可以通過php -v 可看php是否安裝成功。

8,如果php -v 無法執(zhí)行,可以將php加入到環(huán)境變量:

編輯環(huán)境變量文件: vi /etc/profile

文件末尾加上 export PATH="/usr/local/php/bin:$PATH"

其中"/usr/local/php/bin"為你安裝的具體路徑,保存退出后,執(zhí)行以下更改即可,執(zhí)行命令:

source /etc/profile

這個(gè)時(shí)候我們?cè)俅螆?zhí)行php -v 就可以看到所安裝的版本號(hào)了。

到此安裝完成。

標(biāo)簽:

本文地址:http://www.yganxi.com/help/850.html

簡米科技服務(wù)器支持24小時(shí)免費(fèi)測(cè)試


成為簡米科技會(huì)員,享受出眾的上云實(shí)踐機(jī)會(huì)和周到的尊貴服務(wù)!
主站蜘蛛池模板: 崇义县| 阜南县| 明星| 杨浦区| 灵宝市| 临江市| 蒙阴县| 松江区| 衡东县| 池州市| 海门市| 锦屏县| 民和| 航空| 曲阳县| 南川市| 榆中县| 吉木乃县| 溧阳市| 华亭县| 本溪| 扶沟县| 龙江县| 高清| 商河县| 原平市| 武宣县| 磐石市| 大港区| 兴宁市| 兴隆县| 涞源县| 峨山| 宁都县| 客服| 安陆市| 永吉县| 凤庆县| 泗阳县| 焦作市| 阿拉尔市|