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

技術(shù)文檔

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

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

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

我們以安裝nginx1.8+php7.2版本為例進行手動安裝,具體安裝流程如下:

一、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)找到你想要安裝的版本進行下載

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

1)進入目錄: 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)進入解壓后目錄: cd nginx-1.8.0

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

. /configure

make make install

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

1)進入/usr/local/nginx 目錄下:

cd /usr/local/nginx

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

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

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,測試啟動服務(wù)

systemctl start nginx.service

6,查看是否啟動

ps -ef | grep nginx

7,設(shè)置開機自啟動

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,進入到/usr/local目錄下,下載php安裝包:

cd /usr/local

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

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

3,解壓

tar -zxvf php-7.2.10.tar.gz

4,進入解壓出來的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

這個時候我們再次執(zhí)行php -v 就可以看到所安裝的版本號了。

到此安裝完成。

標簽:

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

簡米科技服務(wù)器支持24小時免費測試


成為簡米科技會員,享受出眾的上云實踐機會和周到的尊貴服務(wù)!
主站蜘蛛池模板: 柳江县| 黄龙县| 蒲江县| 鄂尔多斯市| 盐边县| 宁蒗| 百色市| 敦化市| 三原县| 衢州市| 富蕴县| 龙南县| 德格县| 晋城| 泗阳县| 新宁县| 阜南县| 贡觉县| 郁南县| 盖州市| 乐安县| 双城市| 江津市| 滨海县| 舒兰市| 确山县| 建湖县| 平舆县| 金寨县| 宁远县| 谢通门县| 贵州省| 洮南市| 澳门| 元谋县| 平顶山市| 岳阳县| 逊克县| 敦煌市| 闽侯县| 康平县|