nginx 配置文件说明之location之静态文件配置

http{

    server {
            listen 8080;                                          监听的端口
            server_name loaclhost;                       服务名称 / ip

            location / {                                            访问路径
               root lichong;                                      这里要特别说明 : 如果直接这样写lichong文件夹要和nginx的conf文件夹同级目录,如果不在统计目录,要配置绝对路径,例如下面server
               index lichong.html;
            }
            # each server can has is's logs,  "main" --> is the logs's style defines upstairs
            # access_log  logs/access.8080.log  main;
      }


    server {
        listen 8081;
        server_name loaclhost;

        location / {
           root /data/test_nginx;           这里说明要访问的test_nginx.html所存放的目录没有和conf文件夹同级,要写绝对路径
           index test_nginx.html;
        }
        # each server can has it's logs
        # access_log  logs/access.8081.log main;
     }

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章