CentOS配置Nginx及常見命令

2022-07-21 12:42:15 字數 655 閱讀 8088

一、配置nginx環境變數

在/etc/profile 檔案結尾中加入配置 ,命令:vim /etc/profile

export nginx_home=/usr/local/nginx

export path=$path:$nginx_home/sbin

編譯完儲存退出並執行 source /etc/profile

執行命令 nginx -v 顯示nginx 版本號說明環境變數配置成功

二、nginx常見命令

驗證配置是否正確:/usr/local/nginx/sbin/nginx -t

檢視詳細版本號:nginx -v

檢視簡潔版本號:nginx -v

首次啟動nginx: (進入../nginx目錄下)./sbin/nginx -c conf/nginx.conf

啟動:nginx

配置檔案修改過載:/usr/local/nginx/sbin/nginx –s reload

快速停止或關閉:/usr/local/nginx/sbin/nginx –s stop

正常停止或關閉:/usr/local/nginx/sbin/nginx –s quit

強制關閉:pkill nginx

CentOS7安裝nginx及配置

1 安裝準備依賴lib庫 我也不知道是不是,反正搜到的 sudo yum install gcc c pcre pcre devel zlib zlib devel openssl openssl devel 2 yum中新增nginx 直接安裝的時候報 有可用軟體包 nginx sudo rpm ...

CentOS7安裝Nginx及配置

1.安裝gcc gcc c 如新環境,未安裝請先安裝 yum install y gcc gcc c 2.安裝pcre庫 cd usr local wget tar zxvf pcre 8.33.tar.gz cd pcre 8.33 configure make make install3.安裝s...

CentOS7安裝Nginx及配置

nginx是一款輕量級的網頁伺服器 反向 伺服器。相較於apache lighttpd具有占有記憶體少,穩定性高等優勢。它最常的用途是提供反向 服務。安裝 首先安裝必要的庫 nginx 中gzip模組需要 zlib 庫,rewrite模組需要 pcre 庫,ssl 功能需要openssl庫 選定 u...