如标题所示,我正在尝试运行nextcloud和 Desktop for 中的OnlyOffice,并且我试图阻塞nginx以接受通过LANE 29
的连接,这样我就可以从网络上的其他计算机连接到服务器,所有这些计算机都在运行E 110
Windows 10E 211
。
虽然我在网上读过很多类似的文章,但似乎没有一个有我的特别设置,我也不知道从这里该怎么做。
到目前为止我所做的:
1-安装了windows社区版的对接引擎,以及Kitematic 。我正在使用Docker的默认容器,所以我没有安装VirtualBox。在我的"D:/“驱动器上配置它的"DockerDesktop.vhdx”。
docker-onlyoffice-nextcloud 2-使用github页面上的说明安装了https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud:https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud。我遇到了nextcloud服务器无法访问OnlyOffice服务器的问题,并设法“修复”了这个问题,方法是使用OnlyOffice server打开OnlyOffice服务器上的端口,并在E 137
nextcloud服务器<代码>E 238中配置OnlyOffice应用程序E 236
来连接到它(使用nextcloud web接口)。
3-,我现在可以在主机上访问上的nextcloud,但是我没有运气从网络上的任何其他计算机连接到它。
问题:
我无法弄清楚是什么原因阻止我在本地连接到服务器,但我猜想这与nginx服务器配置有关。
Tried:
有些人建议检查nginx.conf,以确保listen 80;已启用,在我看来是这样的。其他人建议使用server_name localhost;后的听80;,这似乎也没有做任何事情。
我已经检查了Windows共享选项,打开了网络发现,认为这可能与其有关,但没有效果。
下面是用于此设置的配置文件和脚本,以供参考:
docker-compose.yml
version: '3'
services:
app:
container_name: app-server
image: nextcloud:fpm
stdin_open: true
tty: true
restart: always
expose:
- '80'
- '9000'
volumes:
- app_data:/var/www/html
onlyoffice-document-server:
container_name: onlyoffice-document-server
image: onlyoffice/documentserver:latest
stdin_open: true
tty: true
restart: always
expose:
- '80'
- '443'
volumes:
- document_data:/var/www/onlyoffice/Data
- document_log:/var/log/onlyoffice
nginx:
container_name: nginx-server
image: nginx
stdin_open: true
tty: true
restart: always
ports:
- 80:80
- 443:443
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- app_data:/var/www/html
volumes:
document_data:
document_log:
app_data:
mysql_data:
nginx.conf
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
upstream backend {
server app-server:9000;
}
include /etc/nginx/mime.types;
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"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
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;
}
server {
listen 80;
# Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
root /var/www/html;
client_max_body_size 10G; # 0=unlimited - set max upload size
fastcgi_buffers 64 4K;
gzip off;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
rewrite ^/.well-known/carddav /remote.php/dav/ permanent;
rewrite ^/.well-known/caldav /remote.php/dav/ permanent;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location / {
rewrite ^/remote/(.*) /remote.php last;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ =404;
}
location ~* ^/ds-vpath/ {
rewrite /ds-vpath/(.*) /$1 break;
proxy_pass http://onlyoffice-document-server;
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 ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS off;
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_pass backend;
fastcgi_intercept_errors on;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the location ~ \.php(?:$|/) { block
location ~* \.(?:css|js)$ {
add_header Cache-Control "public, max-age=7200";
# Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
}
# Optional: Don't log access to other assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
access_log off;
}
}
}
set_configuration.sh
set -x
docker exec -u www-data app-server php occ --no-warnings config:system:get trusted_domains >> trusted_domain.tmp
if ! grep -q "nginx-server" trusted_domain.tmp; then
TRUSTED_INDEX=$(cat trusted_domain.tmp | wc -l);
docker exec -u www-data app-server php occ --no-warnings config:system:set trusted_domains $TRUSTED_INDEX --value="nginx-server"
fi
rm trusted_domain.tmp
docker exec -u www-data app-server php occ --no-warnings app:install onlyoffice
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice DocumentServerUrl --value="/ds-vpath/"
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice DocumentServerInternalUrl --value="http://onlyoffice-document-server/"
docker exec -u www-data app-server php occ --no-warnings config:system:set onlyoffice StorageUrl --value="http://nginx-server/"```
[1]: https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud
发布于 2019-11-07 08:14:19
如果问题在windows防火墙中,请尝试禁用它并测试连接是否有效。如果工作正常,请重新启动windows防火墙,然后您可以按照下面的说明进行操作:
单击“启动”并在您的主机上键入Windows防火墙。
2-点击Windows防火墙与高级安全。
3-在窗口左侧查找入站规则,然后右击它。
4-单击新规则.和一个新窗口将出现。
5-在Rule选项卡上选择端口,然后单击Next。
6-在协议和端口选项卡下,在第一选择中选择TCP,在第二选择中选择特定本地端口:,并在文本框中键入80。单击Next。
7-在“Action”选项卡下,选择“允许连接”。
8-在Profile选项卡下,选择“所有”复选框,然后单击“Next”。
9-在 name 选项卡下,为您的规则提供一个名称,并输入一个关于它是什么的小描述,这样您就可以记住创建它的原因了。单击Finish。
此规则现在应该是活动的,您应该能够通过在同一网络上的另一台计算机上键入其IP地址来连接到您的服务器。
请注意,我对这一主题的了解还不够充分,而且我正在学习。我正在使用这个软件包来完成个人任务和学习,所以安全性对我来说不是什么大问题,我也不知道我的这个“解决方案”从专家的角度来看有多糟糕。
所以请谨慎行事。。
https://stackoverflow.com/questions/58707096
复制相似问题