配置文件目录:nginx/conf

注:server配置项【key value;】表示,必须分号分割

server {
        listen 1234;  #端口
        server_name nginx.com;  #应用层代理:域名、IP、localhost(本机IP),访问Nginx域名

        location / {  #正则表达式 =、~、字符串  "/" 路径(相对于nginx文件夹为"/")
            root nginx.com;  #项目文件夹,前面没加"/"表示相对路径
            index index.html;  #默认欢迎页面,可配置多个(优先展示级别从左往右,空格隔开)
        }
    
     error_page 404  /error.html;  #错误代码对应错误页面
     location = /error.html {  #配置错误页面("="精准匹配到项)
       root nginx.com;
     }
}

 

posted on 2020-06-06 21:38  来临  阅读(112)  评论(0编辑  收藏  举报