如何解决在位置使用具有多个根的Nginx
我正在尝试为应用程序中的位置设置多个根。
我的mainapp是从根目录"../gestan-cloud/dist"
但是,我有一个查看器文件夹,其中包含"../gestan-cloud/node_server_app/viewer"
和其他“ index.html”。
我需要将该文件放入应用页面中的iframe中。
我的mais应用程序运行良好,但无法使iframe正常工作。
"index.html"
中的"../gestan-cloud/node_server_app/viewer"
从未显示在iframe中。
我的页面无法加载iframe。 "/gestdicom/default.html"
是伪造的url,仅用于nginx重定向到"../gestan-cloud/node_server_app/viewer/index.html"
:
<div>
<iframe
src="/gestdicom/default.html"
width="100%"
height="100%"
frameborder="0"
></iframe>
</div>
我的应用文件夹:
\mainApp
| \gestan-cloud
| \dist
| index.html
| \css
| \node_server_app
| \viewer
| index.html
|
| \nginx-1.18.0
| \conf
| \docs
| ....
//这是我的Nginx文件配置文件
worker_processes 2;
error_log logs/error.log;
error_log logs/error.log notice;
events {
worker_connections 1024;
}
http {
rewrite_log on;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
# Enable SSL
ssl_certificate ../ssl/cert.pem;
ssl_certificate_key ../ssl/key.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name gestan1.myapp.local;
#main app index.html
location / {
root ../gestan-cloud/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ~ ^/(api|uploads|public)/ {
access_log off;
proxy_pass http://localhost:3001$request_uri;
}
#socket io
location ~* \.io {
access_log off;
include proxy_io_params.conf;
proxy_pass http://localhost:3001;
}
#redirect para o server ohif
location /gestdicom/ {
root ../gestan-cloud/node_server_app/viewer;
index index.html;
rewrite ^/gestdicom(.*)$ /$1;
try_files $uri $uri/ =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。