98 lines
3.1 KiB
Nginx Configuration File
98 lines
3.1 KiB
Nginx Configuration File
|
||
user root;
|
||
worker_processes auto;
|
||
|
||
events {
|
||
worker_connections 1024;
|
||
}
|
||
|
||
http {
|
||
include mime.types;
|
||
default_type application/octet-stream;
|
||
sendfile on;
|
||
gzip on;
|
||
gzip_min_length 1k;
|
||
gzip_comp_level 4;
|
||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
|
||
gzip_disable "MSIE [1-6]\.";
|
||
gzip_vary on;
|
||
proxy_redirect off;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header https $https;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
client_max_body_size 75M; #缓冲区代理缓冲用户端请求的最大字节数,可以理解为保存到本地再传给用户
|
||
client_body_buffer_size 256k;
|
||
client_header_timeout 3m;
|
||
client_body_timeout 3m;
|
||
send_timeout 3m;
|
||
proxy_connect_timeout 300s; #nginx跟后端服务器连接超时时间(代理连接超时)
|
||
proxy_read_timeout 300s; #连接成功后,后端服务器响应时间(代理接收超时)
|
||
proxy_send_timeout 300s;
|
||
proxy_buffer_size 64k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
|
||
proxy_buffers 4 32k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置
|
||
proxy_busy_buffers_size 64k; #高负荷下缓冲大小(proxy_buffers*2)
|
||
proxy_temp_file_write_size 64k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传递请求,而不缓冲到磁盘
|
||
proxy_ignore_client_abort on; #不允许代理端主动关闭连接
|
||
|
||
upstream GreaterWMS{
|
||
server 127.0.0.1:8008;
|
||
}
|
||
server {
|
||
listen 80;
|
||
server_name {{ Domin Name }};
|
||
rewrite ^(.*)$ https://{{ Domin Name }}$1;
|
||
|
||
}
|
||
|
||
server {
|
||
listen 443 ssl;
|
||
|
||
server_name {{ Domin Name }};
|
||
root /path/to/GreaterWMS;
|
||
charset utf-8;
|
||
add_header X-Frame-Options "SAMEORIGIN";
|
||
add_header X-XSS-Protection "1; mode=block";
|
||
add_header X-Content-Type-Options "nosniff";
|
||
|
||
client_max_body_size 75M;
|
||
|
||
ssl_certificate /path/to/GreaterWMS.pem;
|
||
ssl_certificate_key /path/to/GreaterWMS.key;
|
||
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;
|
||
|
||
access_log off;
|
||
error_log /path/to/GreaterWMS/greaterwms-error.log error;
|
||
|
||
location /websocket/ {
|
||
proxy_pass http://GreaterWMS/;
|
||
proxy_read_timeout 60s;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real_IP $remote_addr;
|
||
proxy_set_header X-Forwarded-for $remote_addr;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection 'Upgrade';
|
||
}
|
||
|
||
location / {
|
||
#root html;
|
||
#index testssl.html index.html index.htm;
|
||
proxy_redirect off;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_pass http://127.0.0.1:8008/;
|
||
}
|
||
location /static/ {
|
||
alias /path/to/GreaterWMS/static_new/;
|
||
}
|
||
location /media/{
|
||
alias /path/to/GreaterWMS/media/;
|
||
}
|
||
}
|
||
}
|