以下文件均在nginx的conf目录下面
坐标:nginx.conf
#user nobody;
worker_processes 8;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 65535;
}
http {
include mime.types;
server_names_hash_bucket_size 128;
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"';
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
keepalive_timeout 65;
include onlyoffice-*.conf;
}
}
坐标:onlyoffice-documentserver-ssl.conf 与 nginx.conf 同级目录
include includes/onlyoffice-http.conf;
## Normal HTTP host
server {
listen 0.0.0.0:8083;
listen [::]:8083 default_server;
server_name _;
server_tokens off;
server {
listen 0.0.0.0:8083;
listen [::]:8083 default_server;
server_name _;
server_tokens off;
## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
#HTTP host for internal services
server {
listen 127.0.0.1:8083;
listen [::1]:8083;
server_name localhost;
server_tokens off;
server {
listen 127.0.0.1:8083;
listen [::1]:8083;
server_name localhost;
server_tokens off;
include includes/onlyoffice-documentserver-common.conf;
include includes/onlyoffice-documentserver-docservice.conf;
}
server {
listen 80;
server_tokens off;
include includes/onlyoffice-documentserver-docservice.conf;
}
server {
listen 80;
server_tokens off;
## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
## HTTPS host
server {
listen 443 ssl;
server_name www.baidu.com;
server_tokens off;
root /usr/share/nginx/html;
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
## HTTPS host
server {
listen 443 ssl;
server_name www.baidu.com;
server_tokens off;
root /usr/share/nginx/html;
ssl on;
ssl_certificate doc.pem;
ssl_certificate_key doc.key;
ssl_certificate doc.pem;
ssl_certificate_key doc.key;
ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security max-age=31536000;
add_header X-Content-Type-Options nosniff;
add_header X-Content-Type-Options nosniff;
include includes/onlyoffice-documentserver-*.conf;
}
server {
listen 443 ssl;
server_name localhost(可替换自己的域名);
server {
listen 443 ssl;
server_name localhost(可替换自己的域名);
ssl_certificate 2017.pem;
ssl_certificate_key 2017.key;
client_body_timeout 10s;
client_header_timeout 10s;
large_client_header_buffers 4 8k;
client_header_buffer_size 1k;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
ssl_certificate_key 2017.key;
client_body_timeout 10s;
client_header_timeout 10s;
large_client_header_buffers 4 8k;
client_header_buffer_size 1k;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
#ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_prefer_server_ciphers on;
#ssl_prefer_server_ciphers on;
charset utf-8;
location /tr_north{
proxy_pass http://tr_north;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_connect_timeout 6s;
proxy_send_timeout 6s;
proxy_read_timeout 6s;
proxy_buffer_size 4k;
proxy_buffers 32 4k;
proxy_busy_buffers_size 64k;
client_max_body_size 10m;
client_body_buffer_size 128k;
}
location /tr_north_test{
proxy_pass http://tr_north_test;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_connect_timeout 6s;
proxy_send_timeout 6s;
proxy_read_timeout 6s;
proxy_buffer_size 4k;
proxy_buffers 32 4k;
proxy_busy_buffers_size 64k;
client_max_body_size 10m;
client_body_buffer_size 128k;
}
location /{
proxy_pass http://docservice;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_connect_timeout 2;
client_max_body_size 1000m;
}
location /tr_north{
proxy_pass http://tr_north;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_connect_timeout 6s;
proxy_send_timeout 6s;
proxy_read_timeout 6s;
proxy_buffer_size 4k;
proxy_buffers 32 4k;
proxy_busy_buffers_size 64k;
client_max_body_size 10m;
client_body_buffer_size 128k;
}
location /tr_north_test{
proxy_pass http://tr_north_test;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_connect_timeout 6s;
proxy_send_timeout 6s;
proxy_read_timeout 6s;
proxy_buffer_size 4k;
proxy_buffers 32 4k;
proxy_busy_buffers_size 64k;
client_max_body_size 10m;
client_body_buffer_size 128k;
}
location /{
proxy_pass http://docservice;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_connect_timeout 2;
client_max_body_size 1000m;
}
}
坐标:includes/onlyoffice-http.conf
upstream tr_north{
ip_hash;
server 127.0.0.1:8089 weight=3 max_fails=1 fail_timeout=90s;
#keepalive 20;
}
ip_hash;
server 127.0.0.1:8089 weight=3 max_fails=1 fail_timeout=90s;
#keepalive 20;
}
upstream tr_north_test{
ip_hash;
server 127.0.0.1:9080 weight=3 max_fails=1 fail_timeout=90s;
#keepalive 20;
}
ip_hash;
server 127.0.0.1:9080 weight=3 max_fails=1 fail_timeout=90s;
#keepalive 20;
}
proxy_cache_path temp/
levels=1:2
keys_zone=fonts_cache:1m
inactive=1d
max_size=256m;
levels=1:2
keys_zone=fonts_cache:1m
inactive=1d
max_size=256m;
map $http_host $this_host {
"" $host;
default $http_host;
}
"" $host;
default $http_host;
}
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $this_host;
}
default $http_x_forwarded_host;
"" $this_host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
default upgrade;
"" close;
}
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;