1.安裝依賴包
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
檢視ssh -v
如果有openssl,也可以不用安裝openssl
[root@localhost nginx]# ssh -v
openssh_8.0p1, openssl 1.0.2k-fips 26 jan 2017
//解壓
tar -zxvf nginx-1.19.0.tar.gz
//進入目錄
cd nginx-1.19.0
//執行命令
./configure
//執行make命令
make
//執行make install命令
make install
4.配置nginx.conf
# 開啟配置檔案
vim /usr/local/nginx/conf/nginx.conf
修改配置檔案
server
}
5.啟動nginx
如果出現報錯:nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed
則執行: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
再次啟動即可!
[root@localhost nginx]# sbin/nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: no such file or directory)
[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
[root@localhost nginx]# sbin/nginx -s reload
[root@localhost nginx]# ps -ef | grep nginx
root 300 1 0 16:05 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody 306 300 0 16:05 ? 00:00:00 nginx: worker process
root 319 4081 0 16:05 pts/0 00:00:00 grep --color=auto nginx
6.安裝完成一般常用命令
進入安裝目錄中
命令: cd /usr/local/nginx/sbin
啟動,關閉,重啟,命令:
./nginx 啟動
./nginx -s stop 關閉
./nginx -s reload 重啟
LINUX安裝nginx詳細步驟
1.安裝依賴包 一鍵安裝需要的四個依賴 yum y install gcc zlib zlib devel pcre devel openssl openssl devel 如果zlib 安裝失敗步驟 wget tar zxf zlib 1.2.11.tar.gz configure make ma...
Linux安裝nginx詳細步驟
1 依賴包 7.tar.gz3 安裝 進入目錄 cd nginx 1.13 7 執行命令 configure 執行make命令 make 執行make install命令 make install4 配置nginx.conf 開啟配置檔案 vi nginx conf nginx.conf 修改ngi...
Linux 安裝Nginx詳細步驟
cd usr loca src yum install gcc yum install pcre devel yum install zlib zlib devel yum install openssl openssl devel 3.安裝nginx cd usrl local 解壓nginx包 ...