Skip to content

Commit 5303952

Browse files
committed
proxying documentserver using virtual path
1 parent 48f701d commit 5303952

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

nginx.conf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ http {
8888
try_files $uri $uri/ =404;
8989
}
9090

91-
location ~* "^/([\d]{4}-[\d]{2}-[\d]{2}-[\d]{2}-[\d]{2}\/)?(downloadas|license|cache|upload|uploadold|doc|coauthoring|spellchecker|OfficeWeb|web-apps|sdkjs|fonts|OnlineEditorsExample|CanvasService\.ashx|ConvertService\.ashx|fileDownloader\.ashx|FileUploader\.ashx|FontService\.ashx|ResourceService\.ashx|TrackingService\.ashx|UploadService\.ashx|plugins\.json)" {
91+
location ~* ^/ds-vpath/ {
92+
rewrite /ds-vpath/(.*) /$1 break;
9293
proxy_pass http://onlyoffice-document-server;
9394
proxy_redirect off;
9495

@@ -98,12 +99,13 @@ http {
9899
proxy_set_header Upgrade $http_upgrade;
99100
proxy_set_header Connection "upgrade";
100101

102+
proxy_set_header Host $http_host;
103+
proxy_set_header X-Real-IP $remote_addr;
101104
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
102-
proxy_set_header X-Forwarded-Host $the_host;
105+
proxy_set_header X-Forwarded-Host $the_host/ds-vpath;
103106
proxy_set_header X-Forwarded-Proto $the_scheme;
104107
}
105108

106-
107109
location ~ \.php(?:$|/) {
108110
fastcgi_split_path_info ^(.+\.php)(/.+)$;
109111
include fastcgi_params;

set_configuration.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ docker cp ./onlyoffice app-server:/var/www/html/apps/
1515

1616
docker exec -u www-data app-server php occ --no-warnings app:enable onlyoffice
1717

18-
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice DocumentServerUrl --value="/"
19-
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice DocumentServerInternalUrl --value="http://onlyoffice-document-server/"
18+
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice DocumentServerUrl --value="/ds-vpath/"
19+
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice DocumentServerInternalUrl --value="http://nginx-server/ds-vpath/"
2020
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice StorageUrl --value="http://nginx-server/"

0 commit comments

Comments
 (0)