Linux Nginx 安裝筆記

2021-08-01 13:50:08 字數 3054 閱讀 4677

環境:vmware workstation 10,centos-7-x86_64-***-1511.iso,xshell 4.0,ip:192.168.216.140

[root@localhost ~]# yum list nginx* #yum檢視nginx安裝資訊

已載入外掛程式:fastestmirror

loading mirror speeds from cached hostfile

* base: mirrors.tuna.tsinghua.edu.cn

* extras: mirror.bit.edu.cn

* updates: mirror.bit.edu.cn

錯誤:沒有匹配的軟體包可以列出

[root@localhost ~]# yum list pcre pcre-devel zlib zlib-devel openssl openssl-devel

已安裝的軟體包

openssl.x86_64 1:1.0.1e-42.el7.9 @anaconda

pcre.x86_64 8.32-15.el7 @anaconda

zlib.x86_64 1.2.7-15.el7 @anaconda

可安裝的軟體包

openssl.x86_64 1:1.0.1e-60.el7_3.1 updates

openssl-devel.i686 1:1.0.1e-60.el7_3.1 updates

openssl-devel.x86_64 1:1.0.1e-60.el7_3.1 updates

pcre.i686 8.32-15.el7_2.1 base

pcre.x86_64 8.32-15.el7_2.1 base

pcre-devel.i686 8.32-15.el7_2.1 base

pcre-devel.x86_64 8.32-15.el7_2.1 base

zlib.i686 1.2.7-17.el7 base

zlib.x86_64 1.2.7-17.el7 base

zlib-devel.i686 1.2.7-17.el7 base

zlib-devel.x86_64 1.2.7-17.el7 base

[root@localhost ~]# yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel #yum安裝nginx所需依賴

[root@localhost ~]# rpm -uvh #rpm安裝nginx yum repo源

[root@localhost ~]# yum list nginx #yum 再次檢視nginx安裝資訊

已載入外掛程式:fastestmirror

nginx | 2.9 kb 00:00:00

nginx/x86_64/primary_db | 24 kb 00:00:00

loading mirror speeds from cached hostfile

* base: mirrors.tuna.tsinghua.edu.cn

* extras: mirror.bit.edu.cn

* updates: mirror.bit.edu.cn

可安裝的軟體包

nginx.x86_64 1:1.12.0-1.el7.ngx nginx

[root@localhost ~]# yum install nginx #yum安裝nginx

[root@localhost ~]# service nginx start #啟動nginx

redirecting to /bin/systemctl start nginx.service

[root@localhost ~]# ps -ef | grep nginx #ps命令檢視nginx程序

root 15531 1 0 11:27 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

nginx 15532 15531 0 11:27 ? 00:00:00 nginx: worker process

root 15867 2681 0 11:31 pts/0 00:00:00 grep –color=auto nginx

[root@localhost ~]# service nginx status #service檢視nginx執行狀態

redirecting to /bin/systemctl status nginx.service

● nginx.service - nginx - high performance web server

loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)

active:active (running)since 三 2017-05-24 11:27:55 cst; 3min 47s ago

注意:下面兩條命令「–」是兩個「-」,csdn顯示有誤。

[root@localhost ~]# firewall-cmd –zone=public –add-port=80/tcp –permanent #防火牆永久開放80埠號

success

[root@localhost ~]# firewall-cmd –reload #重啟防火牆是新開放的埠號生效

success

#網頁訪問

LINUX nginx服務安裝

安裝 yum install epel relase y yum install nginx y 安裝完可以檢視nginx的配置資訊檔案 vim etc nginx nginx.conf 修改完conf檔案,則應重啟nginx軟體 不推薦 systemctl restart nginx system...

linux nginx 安裝啟動

首先安裝必要的庫 nginx 中gzip模組需要 zlib 庫,rewrite模組需要 pcre 庫,ssl 功能需要openssl庫 選定 usr local 為安裝目錄,以下具體版本號根據實際改變。1.安裝gcc gcc c 如新環境,未安裝請先安裝 yum install y gcc gcc ...

linux nginx安裝 使用教程

2.上傳到linux伺服器上 可用scp命令上傳 並解壓 執行命令 tar zxvf nginx 1.11.3.tar.gz 3.nginx需要依賴很多底層的報,預設伺服器會少這幾個包,必須安裝,我們只要執行如下命令即可全部一鍵安裝完成 執行命令 yum install autoconf autom...