feat:提交
This commit is contained in:
104
deploy/nginx/conf/nginx.conf
Normal file
104
deploy/nginx/conf/nginx.conf
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
# For more information on configuration, see:
|
||||
# * Official English Documentation: http://nginx.org/en/docs/
|
||||
# * Official Russian Documentation: http://nginx.org/ru/docs/
|
||||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
|
||||
include /usr/share/nginx/modules/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
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;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
client_max_body_size 500m;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
||||
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
||||
# for more information.
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
gzip on; # 开启压缩
|
||||
gzip_min_length 1k; #设置压缩最小单位,小于不压缩
|
||||
#gzip_disable "msie6";
|
||||
|
||||
#gzip_vary on;
|
||||
#gzip_proxied any;
|
||||
gzip_comp_level 4; #压缩比
|
||||
gzip_buffers 4 16k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
upstream chat-master {
|
||||
server chat-master-server:8088 weight=1;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server; # 使用 default_server 表示默认服务器
|
||||
#listen [::]:80 default_server; # 如果需要支持 IPv6
|
||||
#listen 443 ssl;
|
||||
#server_name hostname.com;
|
||||
|
||||
client_max_body_size 100M;
|
||||
# Load configuration files for the default server block.
|
||||
# 此处如需使用443端口,替换为自己的证书并取消注释
|
||||
#ssl_certificate /usr/local/data/nginx/cert/panday94.xyz.pem;
|
||||
#ssl_certificate_key /usr/local/data/nginx/cert/panday94.xyz.key;
|
||||
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 5m;
|
||||
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
location /chat-master {
|
||||
proxy_pass http://chat-master;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Port $Server_port;
|
||||
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
|
||||
proxy_cache off; # 关闭缓存
|
||||
proxy_buffering off; # 关闭代理缓冲
|
||||
proxy_http_version 1.1;
|
||||
proxy_connect_timeout 4s; #配置点1
|
||||
proxy_read_timeout 60s; #配置点2,如果没效,可以考虑这个时间配置长一点
|
||||
proxy_send_timeout 12s; #配置点3
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/local/data/nginx/html/;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user