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

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > Nginx >内容正文

Nginx

CentOs7.2编译安装Nginx服务器

發(fā)布時(shí)間:2023/12/10 Nginx 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOs7.2编译安装Nginx服务器 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1. 安裝nginx依賴(lài)

首先安裝nginx的依賴(lài)

yum install gcc gcc-c++ openssl openssl-devel cyrus-sasl-md5

2,創(chuàng)建nginx用戶(hù)

如果沒(méi)有nginx,啟動(dòng)nginx時(shí)會(huì)報(bào)錯(cuò)

[root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginx nginx: [emerg] getpwnam("nginx") failed 因此執(zhí)行 groupadd nginx
useradd -s /sbin/nologin -g nigix -M nginx

3,下載最新版nginx安裝包

wget -C http://nginx.org/download/nginx-1.12.0.tar.gz

4,解壓

tar zxvf nginx-1.12.0.tar.gz

5,進(jìn)入nginx目錄

cd nginx-1.12.0

6,編譯設(shè)置

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module

因此要順利的通過(guò)nginx編譯安裝必須安裝的依賴(lài)關(guān)系有:

yum install gc gcc gcc-c++ pcre-devel zlib-devel openssl-devel

如果有錯(cuò)誤提示:./configure: error: C compiler cc is not found

解決方法:

yum install gcc gcc-c++

如果有錯(cuò)誤提示:./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre=<path> option.

解決方法:

yum install pcre-devel

如果有錯(cuò)誤提示:./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using –with-openssl=<path> option.

解決方法:

yum install openssl-devel
7,編譯&安裝 make & make install
8,nginx直接啟動(dòng)方法 /usr/local/nginx/sbin/nginx

 9,現(xiàn)在我們將nginx加入到環(huán)境變量中

vi /etc/profile

隨后我們更新環(huán)境變量 并使用命令再次重啟nginx

寫(xiě)在結(jié)尾:可能會(huì)出現(xiàn)沒(méi)有pid文件的情況

ps?-ef|grep?nginx 過(guò)濾出nginx的進(jìn)程號(hào),然后在配置文件中 pid配置目錄創(chuàng)建一個(gè)pid文件,里面填寫(xiě)nginx的進(jìn)程號(hào)就可以了。

[emerg]: getpwnam(“nginx”) failed

1 2 [root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginx nginx: [emerg] getpwnam("nginx") failed

轉(zhuǎn)載于:https://www.cnblogs.com/pcyy/p/8834851.html

總結(jié)

以上是生活随笔為你收集整理的CentOs7.2编译安装Nginx服务器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

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