nginx-入门篇(一)

这里使用nginx做一个静态资源服务器

1. 下载nginx-1.18版本

2. 新建一个文件夹命名为:nginx-serve,将下载好的nginx文件放到nginx-serve中,其目录结构如下:

 

 其中imgs是我自己新建的文件夹,里面存放的是我自己的图片资源。

3. 在conf文件夹中找到nginx.conf文件,使用vscode将其打开

4. 找到server模块,

listen       8090;
server_name  localhost;
location / {
  root   imgs;
  # index  index.html index.htm;
  autoindex  on;
}
其中端口号是8090,访问地址是localhost:8090,访问的路径是当前路径下imgs文件夹(也就是上面新建的imgs文件夹)

 

 

 

 

 

posted @ 2021-02-07 16:01  PromiseAll  阅读(74)  评论(0)    收藏  举报