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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CentOS 8 利用yum源安装nginx

發(fā)布時間:2024/9/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS 8 利用yum源安装nginx 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

環(huán)境

1, CentOS 8
2, nginx 1.18.0

步驟

1,先安裝 yum-utils

shell> yum install yum-utils

2,添加nginx源。創(chuàng)建文件/etc/yum.repos.d/nginx.repo,文件內(nèi)容如下:

[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true[nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true

3,查看nginx源

shell> yum info nginx CentOS-8 - AppStream 67 kB/s | 4.3 kB 00:00 CentOS-8 - Base 56 kB/s | 3.9 kB 00:00 CentOS-8 - Extras 17 kB/s | 1.5 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 60 kB/s | 4.7 kB 00:00 nginx stable repo 350 B/s | 2.9 kB 00:08 nginx mainline repo 2.1 kB/s | 2.9 kB 00:01 Installed Packages Name : nginx Epoch : 1 Version : 1.18.0 Release : 1.el8.ngx Architecture : x86_64 Size : 3.6 M Source : nginx-1.18.0-1.el8.ngx.src.rpm Repository : @System From repo : nginx-stable Summary : High performance web server URL : http://nginx.org/ License : 2-clause BSD-like license Description : nginx [engine x] is an HTTP and reverse proxy server, as well as: a mail proxy server.

4,安裝nginx

shell> yum install nginx CentOS-8 - AppStream 62 kB/s | 4.3 kB 00:00 CentOS-8 - Base 55 kB/s | 3.9 kB 00:00 CentOS-8 - Extras 18 kB/s | 1.5 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 48 kB/s | 4.7 kB 00:00 nginx stable repo 986 B/s | 2.9 kB 00:03 nginx mainline repo 1.6 kB/s | 2.9 kB 00:01 Dependencies resolved. ================================================================================Package Architecture Version Repository Size ================================================================================ Installing:nginx x86_64 1:1.18.0-1.el8.ngx nginx-stable 806 kTransaction Summary ================================================================================ Install 1 PackageTotal download size: 806 k Installed size: 3.6 M Is this ok [y/N]: y Downloading Packages: nginx-1.18.0-1.el8.ngx.x86_64.rpm 5.7 kB/s | 806 kB 02:20 -------------------------------------------------------------------------------- Total 5.7 kB/s | 806 kB 02:20 warning: /var/cache/dnf/nginx-stable-614ef03fac352fea/packages/nginx-1.18.0-1.el8.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY nginx stable repo 511 B/s | 1.5 kB 00:03 Importing GPG key 0x7BD9BF62:Userid : "nginx signing key <signing-key@nginx.com>"Fingerprint: 573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62From : https://nginx.org/keys/nginx_signing.key Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transactionPreparing : 1/1Running scriptlet: nginx-1:1.18.0-1.el8.ngx.x86_64 1/1Installing : nginx-1:1.18.0-1.el8.ngx.x86_64 1/1Running scriptlet: nginx-1:1.18.0-1.el8.ngx.x86_64 1/1 ----------------------------------------------------------------------Thanks for using nginx!Please find the official documentation for nginx here: * http://nginx.org/en/docs/Please subscribe to nginx-announce mailing list to get the most important news about nginx: * http://nginx.org/en/support.htmlCommercial subscriptions for nginx are available on: * http://nginx.com/products/----------------------------------------------------------------------Verifying : nginx-1:1.18.0-1.el8.ngx.x86_64 1/1Installed:nginx-1:1.18.0-1.el8.ngx.x86_64Complete!

5,啟動nginx

systemctl start nginx

6,查看nginx是否啟動

shell> systemctl status nginx ● nginx.service - nginx - high performance web serverLoaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor pres>Active: active (running) since Sat 2020-05-02 00:08:53 CST; 1s agoDocs: http://nginx.org/en/docs/Process: 25856 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exite>Main PID: 25857 (nginx)Tasks: 2 (limit: 5063)Memory: 2.1MCGroup: /system.slice/nginx.service├─25857 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.co>└─25858 nginx: worker processMay 02 00:08:53 iZm5e97k4o3byiq752mii6Z systemd[1]: Starting nginx - high perfo> May 02 00:08:53 iZm5e97k4o3byiq752mii6Z systemd[1]: nginx.service: Can't open P> May 02 00:08:53 iZm5e97k4o3byiq752mii6Z systemd[1]: Started nginx - high perfor> lines 1-15/15 (END)

或者

shell> ps -ef | grep nginx root 25857 1 0 00:08 ? 00:00:00 nginx: master process /usr/sbin nginx -c /etc/nginx/nginx.conf nginx 25858 25857 0 00:08 ? 00:00:00 nginx: worker process root 25863 25101 0 00:09 pts/2 00:00:00 grep --color=auto nginx

7,查看80端口返回的內(nèi)容

curl localhost:80

其它

也可以手工配置nginx官方y(tǒng)um源,這樣更靈活一些。配制方法參考官方說明:http://nginx.org/en/linux_packages.html

總結(jié)

以上是生活随笔為你收集整理的CentOS 8 利用yum源安装nginx的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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