Nginx多配置文件

部署项目知识

配置

nginx.conf文件中指定其他配置文件的全路径位置include 全路径;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
user root root;
worker_processes 1;

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;

keepalive_timeout 65;

# 指定其他配置文件位置
include /etc/nginx/conf/*.conf;
}

/etc/nginx/conf/创建test.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server {
listen 80;
server_name www.xxxx.com;

location ^~/test/ {
root /opt/test;
index index.html index.htm;

}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
}

}

相关文章

Vi基础命令

Linux基础命令

Centos使用

Centos升级Ruby

Shell脚本

Nginx图片大小限制

Nginx配置WebSocket超时时间和wss