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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

CentOs7.2编译安装Nginx服务器

發布時間:2023/12/10 Nginx 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOs7.2编译安装Nginx服务器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. 安裝nginx依賴

首先安裝nginx的依賴

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

2,創建nginx用戶

如果沒有nginx,啟動nginx時會報錯

[root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginx nginx: [emerg] getpwnam("nginx") failed 因此執行 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,進入nginx目錄

cd nginx-1.12.0

6,編譯設置

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

因此要順利的通過nginx編譯安裝必須安裝的依賴關系有:

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

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

解決方法:

yum install gcc gcc-c++

如果有錯誤提示:./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

如果有錯誤提示:./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直接啟動方法 /usr/local/nginx/sbin/nginx

 9,現在我們將nginx加入到環境變量中

vi /etc/profile

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

寫在結尾:可能會出現沒有pid文件的情況

ps?-ef|grep?nginx 過濾出nginx的進程號,然后在配置文件中 pid配置目錄創建一個pid文件,里面填寫nginx的進程號就可以了。

[emerg]: getpwnam(“nginx”) failed

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

轉載于:https://www.cnblogs.com/pcyy/p/8834851.html

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。