linux下使用yum安装nginx
上一次发了本地安装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>
标签:
nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)