随笔 - 1357  文章 - 0  评论 - 1104  阅读 - 1941万

openresty/nginx配置多个conf文件

Linux/Centos
在/etc/nginx/目录下创建conf.d/,用来存放自定义conf文件

Windows
在D:/dev/nginx-1.9.14/目录下创建conf.d/,用来存放自定义conf文件

1、nginx.conf配置文件

复制代码
#user  nobody;
worker_processes  1;
error_log  logs/error.log;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    #Linux 
    #include /etc/nginx/conf.d/*.conf;
    #Windows
    include ../conf.d/*.conf;
}
复制代码


2、conf.d/下自定义 *.conf文件,如:default.conf文件

复制代码
server {
    listen       80;
    server_name  localhost;
    location / {
        root   html;
        index  index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}
复制代码

 

 

 

posted on   Ruthless  阅读(1169)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
历史上的今天:
2019-08-29 mysql参数之innodb_buffer_pool_size大小设置
2019-08-29 mybatis分页的一种解决方案
2018-08-29 如何设计出优秀的Restful API?
2018-08-29 RocketMQ系列实战
2018-08-29 Windows环境下安装RocketMQ
2017-08-29 Centos iptables防火墙关闭启动详解
2017-08-29 Centos7 开启端口
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示