Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nginx through yum in CentOS7

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to install Nginx through yum in CentOS7. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The implementation steps of installing Nginx in yum mode under CentOS7

Nginx is a powerful high-performance Web and reverse proxy server with many superior features. Such as low overhead, high concurrency, support for caching, support for forward and backward proxies, support for load balancing, support for regularization, support for rewrite, and so on. So there are countless fans. This article briefly describes the installation and deployment of yum based on CentOS 7 for your reference.

If it is a compilation installation, please refer to: install, compile and install Nginx under Linux 6

For common configurations of Nginx, please refer to: Nginx Overview and Daily Management

1. Configure nginx yum source

Demo environment [root@centos7-router ~] # more / etc/redhat-releaseCentOS Linux release 7.2.1511 (Core) [root@centos7-router ~] # vim / etc/yum.repos.d/ nginx.repos [nginx] name=nginx repobaseurl= http://nginx.org/packages/OS/OSRELEASE/$basearch/gpgcheck=0enabled=1 replace OS with rhel or centos,OSRELEASE with 6 or 7 in the above configuration file That is, whether the current Linux is version 6 or 7, check the native ip [root@centos7-router ~] # ip addr | grep inet | grep globalinet 172.24.8.254 and 24 brd 172.24.8.255 scope global eno16777728inet 192.168.1.175 scope global dynamic eno33554960 24 brd 192.168.1.255

Second, install nginx

[root@centos7-router ~] # yum install nginx- y [root@centos7-router ~] # yum install nginx-module-perl.x86_64-y View the related files of the birth process [root@centos7-router ~] # rpm-ql nginx/etc/logrotate.d/nginx/etc/nginx/etc/nginx/conf.d/etc/nginx/conf.d/default.conf/etc/nginx/fastcgi_params/etc/nginx/koi-utf/etc/nginx/koi-win/etc/nginx/mime .types / etc/nginx/modules/etc/nginx/nginx.conf/etc/nginx/scgi_params/etc/nginx/uwsgi_params/etc/nginx/win-utf/etc/sysconfig/nginx/etc/sysconfig/nginx-debug/usr/lib/systemd/system/nginx-debug.service/usr/lib/systemd/system/nginx.service/usr/lib64/nginx/usr/lib64/nginx/modules/usr/libexec/initscripts/legacy-actions/nginx/usr/libexec/initscripts/legacy-actions/nginx/check -reload/usr/libexec/initscripts/legacy-actions/nginx/upgrade/usr/sbin/nginx/usr/sbin/nginx-debug/usr/share/doc/nginx-1.12.2/usr/share/doc/nginx-1.12.2/COPYRIGHT/usr/share/man/man8/nginx.8.gz/usr/share/nginx/usr/share/nginx/html/usr/share/nginx/html/50x.html/usr/share/nginx/html/index.html/var/cache/nginx/var/log/nginx

Third, verify nginx

Launch nginxroot@centos7-router ~] # systemctl start nginx [root@centos7-router ~] # systemctl enable nginx # configure self-launch [root@centos7-router ~] # ss-nltp | grep nginxLISTEN 0 128 *: 80 *: * users: ("nginx", pid=65418,fd=6), ("nginx", pid=65415) Fd=6) View nginx version [root@centos7-router ~] # nginx-vnginx version: nginx/1.12.2 View or modify the configuration file [root@centos7-router ~] # more / etc/nginx/nginx.confuser nginx Worker_processes 1 error error log / var/log/nginx/error.log warn;pid / var/run/nginx.pid;events {worker_connections 1024;} http {include / etc/nginx/mime.types; # Author: Leshamidefault_type application/octet-stream # Blog: http://blog.csdn.net/leshamilog_format main'$remote_addr-$remote_user [$time_local] "$request"''$status $body_bytes_sent "$http_referer"'"$http_user_agent"$http_x_forwarded_for"; access_log / var/log/nginx/access.log main;sendfile on;#tcp_nopush on;keepalive_timeout 65 http_referer on;include / etc/nginx/conf.d/*.conf } [root@centos7-router ~] # firewall-cmd-- add-service=http-- permanent [root@centos7-router ~] # firewall-cmd-- reload verifies nginx [root @ centos7-web] # curl http://172.24.8.254Welcome to nginx verification body {width: 35emmargin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;} Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.Commercial support is available atnginx.com.

Thank you for using nginx.

Thank you for reading! This is the end of the article on "how to install Nginx through yum in CentOS7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report