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

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、略陽(yáng)網(wǎng)絡(luò)推廣、重慶小程序開(kāi)發(fā)公司、略陽(yáng)網(wǎng)絡(luò)營(yíng)銷、略陽(yáng)企業(yè)策劃、略陽(yáng)品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供略陽(yáng)建站搭建服務(wù),24小時(shí)服務(wù)熱線:028-86922220,官方網(wǎng)址:www.cdcxhl.com
一、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è)置開(kāi)機(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)入解壓出來(lái)的php目錄
cd php
注:如果解壓出來(lái)的不是php目錄,可以改名,比如解壓出來(lái)的目錄為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,安裝完成后可以通過(guò)php -v 可看php是否安裝成功。
8,如果php -v 無(wú)法執(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)題:Centos7手動(dòng)安裝nginx+php環(huán)境
文章URL:http://m.fisionsoft.com.cn/article/dpcecog.html


咨詢
建站咨詢
