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