Nginx入门 互动版

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

nginx初体验


  当我们安装完nginx后,我们首先进入nginx的安装目录,启动nginx的服务,然后在地址中输入 http://127.0.0.1/ , 然后我们就会看到"welcome to nginx"。如下图所示

  下面的代码为nginx.conf配置文件中的server段的默认配置,nginx所实现的功能都基于这个文件。我们将在后面的内容中继续进行讲解。

 server {
   listen       80;
   server_name  localhost;
   #charset koi8-r;
   #access_log  logs/host.access.log  main;
   location / {
           root   /root;      #定义服务器的默认网站根目录位置
           index index.php index.html index.htm;   #定义首页索引文件的名称
   }
   #error_page  404              /404.html;
   # redirect server error pages to the static page /50x.html
   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
           root   html;
   }
}
下面就在我们的编辑环境中去试一试吧,首先启动nginx服务,然后点击【访问测试】,看看会出现什么呢?