centos 7安装nginx

1.安装nginx
[root@dsc1 ~]#yum install -y nginx
[root@dsc1 ~]# rpm -qa | grep nginx
nginx-1.20.1-10.el7.x86_64
nginx-filesystem-1.20.1-10.el7.noarch

 

2.启动
systemctl start nginx
systemctl status nginx

 

3.访问
[root@dsc1 ~]# curl -I 127.0.0.1
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Thu, 30 May 2024 01:20:41 GMT
Content-Type: text/html
Content-Length: 4833
Last-Modified: Fri, 16 May 2014 15:12:48 GMT
Connection: keep-alive
ETag: "53762af0-12e1"
Accept-Ranges: bytes

 

4.浏览器访问
http://192.168.1.102

 

5.配置文件路径
/etc/nginx/nginx.conf

 

6.上传一张图片到/usr/share/nginx/html目录
图片名称为a.png
[root@dsc1 html]# ls
404.html 50x.html a.png en-US icons img index.html nginx-logo.png poweredby.png
[root@dsc1 html]#

 

 

7.浏览器访问该图片
http://192.168.1.102/a.png

posted @ 2024-05-30 09:39  slnngk  阅读(39)  评论(0编辑  收藏  举报