大佬教程收集整理的这篇文章主要介绍了centos7 rpm安装nginx,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
地址为:
http://Nginx.org/packages/centos/7/x86_64/RPMS/
下载Nginx-1.18.0-1.el7.ngx.x86_64包
[root@iZ2ze6bgt1xmvd4jc0v7nmZ src]# wget http://Nginx.org/packages/centos/7/x86_64/RPMS/Nginx-1.18.0-1.el7.ngx.x86_64.rpm
[root@iZ2ze6bgt1xmvd4jc0v7nmZ src]# rpm -qa|grep Nginx
如果有安装了 ,执行 rpm -e 进行卸载
rpm 安装方式Nginx 默认安装位置在 /etc/Nginx/ 目录下
[root@iZ2ze6bgt1xmvd4jc0v7nmZ src]# rpm -ivh Nginx-1.18.0-1.el7.ngx.x86_64.rpm warning: Nginx-1.18.0-1.el7.ngx.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY Preparing... ################################# [100%] Updating / installing... 1:Nginx-1:1.18.0-1.el7.ngx ################################# [100%] ---------------------------------------------------------------------- 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.html Commercial subscriptions for Nginx are available on: * http://Nginx.com/products/
[root@iZ2ze6bgt1xmvd4jc0v7nmZ local]# systemctl start Nginx
[root@iZ2ze6bgt1xmvd4jc0v7nmZ local]# systemctl status Nginx ● Nginx.service - Nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/Nginx.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2021-04-06 11:36:21 CST; 1min 38s ago Docs: http://Nginx.org/en/docs/ Process: 2677 ExecStart=/usr/sbin/Nginx -c /etc/Nginx/Nginx.conf (code=exited, status=0/SUCCESS) Main PID: 2678 (Nginx) Tasks: 2 Memory: 1.5M CGroup: /system.slice/Nginx.service ├─2678 Nginx: master process /usr/sbin/Nginx -c /etc/Nginx/Nginx.conf └─2679 Nginx: worker process Apr 06 11:36:21 iZ2ze6bgt1xmvd4jc0v7nmZ systemd[1]: Starting Nginx - high performance web server... Apr 06 11:36:21 iZ2ze6bgt1xmvd4jc0v7nmZ systemd[1]: Started Nginx - high performance web server. [root@iZ2ze6bgt1xmvd4jc0v7nmZ local]#
[root@iZ2ze6bgt1xmvd4jc0v7noZ ~]# curl 172.27.6.3 <!DOCTYPE html> <html> <head> <title>Welcome to Nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to Nginx!</h1> <p>If you see this page, the Nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://Nginx.org/">Nginx.org</a>.<br/> Commercial support is available at <a href="http://Nginx.com/">Nginx.com</a>.</p> <p><em>Thank you for using Nginx.</em></p> </body> </html> [root@iZ2ze6bgt1xmvd4jc0v7noZ ~]#
查询Nginx是否开机自启动
[root@iZ2ze6bgt1xmvd4jc0v7nmZ local]# systemctl list-unit-files |grep Nginx Nginx-debug.service disabled Nginx.service disabled [root@iZ2ze6bgt1xmvd4jc0v7nmZ local]#
设置允许开机自启动
[root@iZ2ze6bgt1xmvd4jc0v7nmZ local]# systemctl enable Nginx Created symlink from /etc/systemd/system/multi-user.target.wants/Nginx.service to /usr/lib/systemd/system/Nginx.service
再次查询
[root@iZ2ze6bgt1xmvd4jc0v7nmZ local]# systemctl list-unit-files|grep Nginx Nginx-debug.service disabled Nginx.service enabled [root@iZ2ze6bgt1xmvd4jc0v7nmZ local]#
rpm 安装方式Nginx 默认安装位置在 /etc/Nginx/ 目录下
[root@iZ2ze6bgt1xmvd4jc0v7nmZ Nginx]# rpm -qa|grep Nginx Nginx-1.18.0-1.el7.ngx.x86_64
停止Nginx服务
[root@iZ2ze6bgt1xmvd4jc0v7nmZ Nginx]# systemctl stop Nginx
卸载
[root@iZ2ze6bgt1xmvd4jc0v7nmZ Nginx]# rpm -e Nginx
删除目录
[root@iZ2ze6bgt1xmvd4jc0v7nmZ Nginx]# rm -rf /etc/Nginx/
以上是大佬教程为你收集整理的centos7 rpm安装nginx全部内容,希望文章能够帮你解决centos7 rpm安装nginx所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。