Nginx 基础配置

最小配置文件【初始配置去掉注释后的所有配置】

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {  #一个server配置就是一个主机,可以配置多个【虚拟主机】 
        listen       80;
        server_name  localhost; 【支持域名、主机名,因为在hosts里有localhost对应的就是 127.0.0.1】
        location / {
            root   html;  【此时的root指的是/usr/local/nginx】
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

 

posted @ 2022-07-08 16:12  以赛亚  阅读(76)  评论(0编辑  收藏  举报