首页 > 系统相关 >linux下使用yum安装nginx

linux下使用yum安装nginx

时间:2022-09-30 11:46:31浏览次数:63  
标签:web 0.0 30 server nginx yum linux LISTEN

上一次发了本地安装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

相关文章

  • linux内核离线升级步骤详解【亲测可用】
    由于种种原因,linux的内核版本需要升级,但由于生产原因往往不能在线升级,在此记录笔者本人昨晚的的离线升级步骤,亲测可用。我们知道,红帽和CentOS同源同宗,内核升级步骤也是一......
  • 用IO多路复用实现 nginx 静态资源代理(C/Java/Golang)
    用IO多路复用实现nginx静态资源代理(C/Java/Golang)效果展示代理HTML代理图片注意,静态资源代理基于HTTP,可以了解上一篇文章:几十行代码使用TCP简单实现HTT......
  • Java 模拟Terminal连接 Linux Console 源代码
    代码和效果如下,已经转换java文件为exe文件,注意要在Pom文件里面添加依赖。  packagecom.javassh3.javassh3;/*-*-mode:java;c-basic-offset:2;indent-tabs-mode:n......
  • 在 nginx 中配置 HSTS 并禁用 TLS 1.0、1.1
    可以使用以下地址工具按需生成nginx配置https://ssl-config.mozilla.org/#server=nginxHSTS的配置为:#HSTS(ngx_http_headers_moduleisrequired)(63072000seco......
  • linux切割日志文件的shell脚本
    #!/bin/bash#获取前一天的日期suffix=`date-d"-1day""+%Y%m%d"`#split命令用于切割文件#-bSIZE:SIZEisanintegerandoptionalunit(example:10Mis10*102......
  • Linux下的shell工作原理是什么?
    Linux系统提供给用户的最重要的系统程序是Shell命令语言​​解释程序​​​。它不属于内核部分,而是在核心之外,以用户态方式运行。其基本功能是解释并执行用户打入的各种命......
  • linux初始化MySQL数据库
    1.停止MySQL  2.删除数据库中所有的文件及日志[root@localhost~]#rm-rf/var/lib/mysql/*#删除mysql目录下所以文件[root@localhost~]#rm-rf/var/log/mysqld.......
  • LINUX常用命令备忘
    问1:linux在虚拟机下咋么从图形模式切换到命令行模式的啊答:运行init3NOTE:在windows虚拟机模式下,Ctrl+Alt+F1~F7,是失效的。但如下却屡试不爽(特别感谢乐乐):终端模式-->命令行......
  • linux可控的复杂度原因探讨
    一、影响复杂度控制的因素总结1)架构。要拥有绝对良好的架构。否则操作系统这种“高楼大厦”是不可能建成的,建到一半就跨了,而且不坚固。2)模块性:保持清晰,保持简洁。(keepingi......
  • linux socket实现网络聊天室(一):服务器和客户端对话
    1.服务器端#include<sys/types.h>#include<sys/socket.h>#include<stdio.h>#include<stdlib.h>#include<errno.h>#include<string.h>#include<unistd.h>#include<ne......