上一次发了本地安装nginx,这次发一个yum安装nginx
1.安装nginx源
我们本机有的可能没有附带nginx源,所以我们这里先进行安装一个nginx源
#rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.安装nginx
# yum install -y nginx
3.启动nginx
# systemctl start nginx
4.查看端口
# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14541/nginx: master tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 961/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1235/master tcp6 0 0 :::22 :::* LISTEN 961/sshd tcp6 0 0 ::1:25 :::* LISTEN 1235/master
5.查看服务
# 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 五 2022-09-30 11:24:30 CST; 4s ago Docs: http://nginx.org/en/docs/ Process: 14540 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 14541 (nginx) CGroup: /system.slice/nginx.service ├─14541 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf ├─14542 nginx: worker process └─14543 nginx: worker process 9月 30 11:24:30 hostname01 systemd[1]: Starting nginx - high performance web server... 9月 30 11:24:30 hostname01 systemd[1]: Started nginx - high performance web server.
6.访问
# curl 192.168.200.50 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> html { color-scheme: light dark; } 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>标签:web,0.0,30,server,nginx,yum,linux,LISTEN From: https://www.cnblogs.com/daiqinghui/p/16744403.html