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;
}
}