DocSpace-buildtools/config/nginx/onlyoffice.conf

302 lines
8.1 KiB
Plaintext

map $http_host $this_host {
"" $host;
default $http_host;
}
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $this_host;
}
map $uri $basename {
~/(?<captured_basename>[^/]*)$ $captured_basename;
}
map $request_uri $header_x_frame_options {
~*^/(favicon\.ico|products\/files\/share|products\/files\/saveas|products\/files\/filechoice|products\/files\/doceditor|thirdparty\/plugin) "";
default "SAMEORIGIN";
}
map $request_uri $cache_control {
default "no-cache, no-store, no-transform";
~*\/(filehandler\.ashx\?action=thumb)|\/(storage\/room_logos\/root\/|storage\/userPhotos\/root\/) "must-revalidate, no-transform, immutable, max-age=31536000";
~*\/(api\/2\.0.*|storage|login\.ashx|filehandler\.ashx|ChunkedUploader.ashx|ThirdPartyAppHandler|apisystem|sh|remoteEntry\.js|debuginfo\.md|static\/scripts.*) "no-cache, no-store, no-transform";
~*\/(images|favicon.ico.*)|\.(js|woff|woff2|css)|(locales.*\.json) "must-revalidate, no-transform, immutable, max-age=31536000";
}
include /etc/nginx/includes/onlyoffice-*.conf;
server {
listen 8092;
add_header X-Frame-Options $header_x_frame_options;
add_header Cache-Control $cache_control;
root $public_root;
etag on;
large_client_header_buffers 4 16k;
client_max_body_size 4G;
set $X_REWRITER_URL $the_scheme://$the_host;
if ($http_x_rewriter_url != '') {
set $X_REWRITER_URL $http_x_rewriter_url ;
}
gzip on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_keep_conn on;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param HTTP_X_REWRITER_URL $http_x_rewriter_url;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO "";
location ~* ^/ds-vpath/ {
rewrite /ds-vpath/(.*) /$1 break;
proxy_pass http://172.18.0.4:80;
proxy_redirect off;
client_max_body_size 100m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $the_host/ds-vpath;
proxy_set_header X-Forwarded-Proto $the_scheme;
}
location / {
proxy_pass http://127.0.0.1:5001;
location ~* /(manifest.json|sw.js|appIcon(.)*\.png|icon.svg|bg-error.png|favicon.ico|debuginfo.md) {
try_files /$basename /index.html =404;
}
location ~* /static/fonts/ {
try_files /fonts/$basename /index.html =404;
}
location ~* /static/offline/ {
try_files /offline/$basename /index.html =404;
}
location ~* /thirdparty/ {
try_files /thirdparty/third-party.html /index.html =404;
}
location ~* /static/locales/(?<content>[^/]+) {
try_files /locales/$content/$basename /index.html =404;
}
location ~* /static/scripts/ {
try_files /scripts/$basename /index.html =404;
}
location ~* /static/plugins/ {
try_files /plugins/$basename /index.html =404;
}
location ~* /static/images/(.*)$ {
try_files /images/$1 /index.html =404;
}
}
location /doceditor {
proxy_pass http://127.0.0.1:5013;
proxy_redirect off;
proxy_set_header Host $this_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
location ~* /static/images/(.*)$ {
try_files /images/$1 /index.html =404;
}
location ~* /static/fonts/ {
try_files /fonts/$basename /index.html =404;
}
}
location /login {
proxy_pass http://127.0.0.1:5011;
proxy_redirect off;
proxy_set_header Host $this_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
location ~* /static/images/(.*)$ {
try_files /images/$1 /index.html =404;
}
location ~* /static/fonts/ {
try_files /fonts/$basename /index.html =404;
}
}
location /sockjs-node {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:5001;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /api/2.0 {
location ~* /(files|privacyroom) {
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /(people|group) {
proxy_pass http://127.0.0.1:5004;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /(authentication|modules|portal|security|settings|smtpsettings|capabilities|thirdparty|encryption|feed) {
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
location ~* portal/(.*)(backup|restore)(.*) {
rewrite (.*)/portal/(.*) $1/backup/$2 break;
proxy_redirect off;
proxy_pass http://127.0.0.1:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* authentication/register(.*) {
rewrite (.*)/authentication/register(.*) $1/people/register$2 break;
proxy_redirect off;
proxy_pass http://127.0.0.1:5004;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}
location ~* /backup {
proxy_pass http://127.0.0.1:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /plugins {
proxy_pass http://127.0.0.1:5014;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /migration {
proxy_pass http://127.0.0.1:5034;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}
location /sso {
rewrite sso/(.*) /$1 break;
proxy_pass http://127.0.0.1:9834;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /(ssologin.ashx|login.ashx|storage) {
proxy_pass http://127.0.0.1:5003;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /socket.io/ {
proxy_pass http://127.0.0.1:9899;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /backupFileUpload.ashx {
proxy_pass http://127.0.0.1:5012;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /logoUploader.ashx {
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /ThirdPartyApp {
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location ~* /filehandler.ashx {
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /ChunkedUploader.ashx {
proxy_pass http://127.0.0.1:5007;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /apisystem {
rewrite apisystem/(.*) /$1 break;
proxy_pass http://127.0.0.1:5010;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /apicache {
rewrite apicache/(.*) /$1 break;
proxy_pass http://127.0.0.1:5100;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /sh {
rewrite sh/(.*) /$1 break;
proxy_pass http://127.0.0.1:9999;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
location /healthchecks {
rewrite /healthchecks/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:5033;
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
}
}