Nginx

  1. apt-get update
  2. apt-get install nginx
  3. sudo systemctl start nginx
  4. sudo systemctl status nginx出现以下界面代表启动成功,如果出现图二,就修改文件权限
    sudo chown nginx:nginx /run/nginx.pid
    sudo chmod 644 /run/nginx.pid

  5. 查看防火墙状态ufw status
    status :inactive代表没有启用
  6. nginx配置文件在/etc/nginx/nginx.conf,此处配置文件中还include了两个配置文件mime.types是字符等配置文件,于是查看conf.d/目录下的配置文件
  7. conf.d/下存在default.conf,添加如图location块,即可通过访问/helin/路径访问到/usr/share/nginx/html下的love.html
    切记修改完配置文件后,nginx -t 查看配置文件是否有错误
    重新加载已经重启(可不执行)
    systemctl reload nginx
    systemctl restart nginx
  8. 可以在/usr/share/nginx/html直接编写txt文档,如下图love.txt,那么可以通过http://ip/love.txt访问到该txt文件
posted @ 2024-10-15 09:41  一个不太会测试的测试  阅读(12)  评论(0)    收藏  举报