CADViewer / NextCloud

CAD viewing, markup and collaboration on NextCloud for AutoCAD, MicroStation and advanced raster graphics.
GNU Affero General Public License v3.0
23 stars 3 forks source link

Error Showing file #3

Closed foxhoundv closed 1 year ago

foxhoundv commented 1 year ago

Hello,

I followed all the setup configuration instructions. I am running Nextcloud-AIO(latest) through Docker on Ubuntu 20.04.5. I received the following error when I tried a test run. image

I grabbed a free PDF 3D file from this website

I checked the configuration steps multiple times to make sure I had them correct. The only difference was that the setup instructions said the chmod 777 the merge folder however there isn't that folder but there is a merged folder. So I chmod 777 merged.

CADViewer commented 1 year ago

Hello, your icon menu at the top indicates an older version of CADViewer NextCloud configuration. It would be great if you could use lastest version 8.17.3. In any case, our PDF input supports 2D vector graphics, not 3D PDF which is a completely different format. ,CADViewer is a primarily tool for AutoCAD and MicroStation vector graphics floorplans.

foxhoundv commented 1 year ago

I am using 8.17.3 image

I just have it disabled now though. Do you have a test file I can try?

CADViewer commented 1 year ago

Yes, we have a number of test drawing in this repo for the other CADViewer encapsulations, you can for example pull a few from: https://github.com/CADViewer/cadviewer-conversion-server/tree/master/content/drawings/dwg

foxhoundv commented 1 year ago

Still there...

image image

foxhoundv commented 1 year ago

Hello, your icon menu at the top indicates an older version of CADViewer NextCloud configuration. It would be great if you could use lastest version 8.17.3. In any case, our PDF input supports 2D vector graphics, not 3D PDF which is a completely different format. ,CADViewer is a primarily tool for AutoCAD and MicroStation vector graphics floorplans.

Today is the first day installing this. I never installed this before, I was waiting for it to show up in the apps.

CADViewer commented 1 year ago

Can you activate the browser inspector, so Ctrl+Shift+I, andl list the full console trace of when you attempt to load drawing? Best is to capture as .txt

Furthermore, please on the top toolbar, click the (i) icon, number 2 from the right, to verify the front-end and back-end version number. Screenshot is fine for that

foxhoundv commented 1 year ago

image image image Is there an email address I can send the txt file to?

CADViewer commented 1 year ago

yes, please use: developer@tailormade.com

foxhoundv commented 1 year ago

yes, please use: developer@tailormade.com

I don't know if you got it but I sent it about half an hour ago.

pureGavin commented 1 year ago

是的,我们在此 repo 中有许多用于其他 CADViewer 封装的测试图,例如,您可以从以下位置提取一些:https ://github.com/CADViewer/cadviewer-conversion-server/tree/master/content/drawings /图纸

i have the same problem, even the test drawing doesn't show up :(

CADViewer commented 1 year ago

@foxhoundv , basically the menu system is not loading (it defaults into the standard settings), and there is no communication with the converter script when the file conversion request is done, so it must be associated to the scripts on the server Can you run the following: (myhttp)/apps/cadviewer/converter/php/whoami.php when logged in. Then also in your cadviewer apps folder: /var/www/html/(nextcloud)/apps/cadviewer/converter/php/ run a $ll to display the content with permission and send me that please: developer@tailormade.com

foxhoundv commented 1 year ago

@CADViewer I am assuming that when you want me to run the following: (myhttp)/apps/cadviewer/converter/php/whoami.php when logged in That you mean from the web browser.

I also just sent you an email with the screenshot.

CADViewer commented 1 year ago

@foxhoundv , looking at the web-browser console trace, we list the nextcloud apps folder is: /var/www/html/apps/cadviewer/converter , and I would expect the /php/ folder to be at /var/www/html/apps/cadviewer/converter/php/ , however at the screenshot you have sent, you have the installation /php/ at /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/cadviewer/converter/php , are all your nextcloud apps installed at: /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/ ?

CADViewer commented 1 year ago

@foxhoundv , yes run the (myhttp)/apps/cadviewer/converter/php/whoami.php from the web-browser. Since I do not have your username/password, I get directed to your main login page. thanks!

foxhoundv commented 1 year ago

@CADViewer When I run that in the browser, it takes me back to the Dashboard page.

foxhoundv commented 1 year ago

@foxhoundv , looking at the web-browser console trace, we list the nextcloud apps folder is: /var/www/html/apps/cadviewer/converter , and I would expect the /php/ folder to be at /var/www/html/apps/cadviewer/converter/php/ , however at the screenshot you have sent, you have the installation /php/ at /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/cadviewer/converter/php , are all your nextcloud apps installed at: /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/ ?

@CADViewer Because it is in Docker, yes this is the location of all the apps: /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/cadviewer/converter/php/

however the container internally recognizes the location as: /var/www/html/apps/cadviewer/converter/php/

That screenshot is ssh'ed in. If I connect to the console it would show it as the other way. I will show you that shortly in an email.

foxhoundv commented 1 year ago

@foxhoundv , looking at the web-browser console trace, we list the nextcloud apps folder is: /var/www/html/apps/cadviewer/converter , and I would expect the /php/ folder to be at /var/www/html/apps/cadviewer/converter/php/ , however at the screenshot you have sent, you have the installation /php/ at /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/cadviewer/converter/php , are all your nextcloud apps installed at: /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/ ?

@CADViewer Because it is in Docker, yes this is the location of all the apps: /var/lib/docker/volumes/nextcloud_aio_nexcoud/_data/apps/cadviewer/converter/php/

however the container internally recognizes the location as: /var/www/html/apps/cadviewer/converter/php/

That screenshot is ssh'ed in. If I connect to the console it would show it as the other way. I will show you that shortly in an email.

I found out that "ll" is shorthand for "ls -alF", @CADViewer I just a new email from the console showing the results.

CADViewer commented 1 year ago

@foxhoundv , our developer feedback for the reference installation of Nextcloud-AIO, is for you to add: RewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/*\.*, into .htaccess in root of installation /var/www/html ,

Zhuangkh commented 1 year ago

same problem. I installed it directly from nextcloud apps, both v8.17.3 & v8.22.2 have this problem

CADViewer commented 1 year ago

We are writing a troubleshoot page, and we will also build in some test scripts in our admin tool to help installations and pass over debug information.

kroko commented 1 year ago

@foxhoundv , our developer feedback for the reference installation of Nextcloud-AIO, is for you to add: RewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/., into .htaccess in root of installation /var/www/html ,

If the fix involves tinkering with web server, could you also look at nginx setup? Thanks!

foxhoundv commented 1 year ago

I have a reverse proxy set with HAProxy.

CADViewer commented 1 year ago

@foxhoundv , we have v8.27.2 up. In the NextCloud Admin tool, you see a "CADViewer Doctor" button which will do a number of permission and settings check and display if it sees anything strange. Please check what you get there. Also please add RewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/., into .htaccess in root of installation /var/www/html, you can find a sample .htaccess file at: https://github.com/CADViewer/NextCloud/blob/main/converter/nextcloud_AIO_sample.htaccess

CADViewer commented 1 year ago

@kroko , please do follow the advise above, install v8.27.2, check if you need to add ewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/., into .htaccess in root of installation /var/www/html, check the "CADViewer Doctor" and provide us feedback. We can then do a nginx setup. If you have screenshots or attachments, please use: developer@tailormade.com

kroko commented 1 year ago

@CADViewer nothing to hide (with few retracted's 😄 )

Screenshot 2023-02-13 at 22 11 50

And current nginx config


upstream retractedinfo-php-handler {
    server unix:/run/php/php7.4-fpm_retractedinfo-nginx-socket_clouduser_nginx_socket.sock;
}

server {
    listen 80;
    listen [::]:80;
    server_name cloud.domain.tld;
    return 302 https://$server_name:443$request_uri;
}

map $arg_v $asset_immutabledev {
    "" "";
    default "immutable";
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    # ===========================================

    server_name  cloud.domain.tld;

    # ===========================================

    root /home/clouduser/retractedinfo-www/live/public;

    # ===========================================

    ssl_certificate             /etc/letsencrypt/live/cloud.domain.tld/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/cloud.domain.tld/privkey.pem;

    ssl_dhparam                 /etc/nginx/retracted-ssl_dhparam/ssl-dhparams-4096.pem;

    ssl_ecdh_curve              secp384r1;

    ssl_trusted_certificate     /etc/letsencrypt/live/cloud.domain.tld/chain.pem;
    ssl_stapling                on;
    ssl_stapling_verify         on;

    ssl_protocols               TLSv1.2;

    ssl_ciphers                 ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers   off; # all ciphers secure, let client choose

    ssl_session_cache           shared:le_nginx_SSL:10m;
    ssl_session_timeout         1d;
    ssl_session_tickets         off;

    ssl_buffer_size             4k;

    server_tokens off;

    # ===========================================

    add_header Strict-Transport-Security "max-age=31536000" always;

    # ===========================================

    client_max_body_size 32G;
    client_body_timeout 19200s;
    fastcgi_buffers 64 4K;

    # ===========================================

    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types
      application/atom+xml
      application/javascript
      application/json
      application/ld+json
      application/manifest+json
      application/rss+xml
      application/vnd.geo+json
      application/vnd.ms-fontobject
      application/wasm
      application/x-font-ttf
      application/x-web-app-manifest+json
      application/xhtml+xml
      application/xml
      font/opentype
      image/bmp
      image/svg+xml
      image/x-icon
      text/cache-manifest
      text/css
      text/plain
      text/vcard
      text/vnd.rim.location.xloc
      text/vtt
      text/x-component
      text/x-cross-domain-policy;

    # ===========================================

    client_body_buffer_size 512k;

    # ===========================================

    # Content-Security-Policy gets built by Nextcloud in the fly
    # add_header Content-Security-Policy "default-src *;";

    # Feature-Policy gets built by Nextcloud in the fly
    # add_header Feature-Policy "payment 'none'; usb 'none';";
    # Permissions-Policy is new name for Feature-Policy
    # add_header Permissions-Policy "microphone=(), camera=(), geolocation=(), payment=(), usb=()";

    add_header Referrer-Policy "no-referrer" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Download-Options "noopen" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "none" always;
    add_header X-XSS-Protection "1; mode=block" always;

    # ===========================================

    fastcgi_hide_header X-Powered-By;

    # ===========================================

    index index.php index.html /index.php$request_uri;
    location = / {
        if ( $http_user_agent ~ ^DavClnt ) {
            return 302 /remote.php/webdav/$is_args$args;
        }
    }

    location = /robots.txt {
        allow all;
        access_log off;
        log_not_found off;
    }

    location ^~ /.well-known {

        location = /.well-known/carddav { return 301 /remote.php/dav/; }
        location = /.well-known/caldav  { return 301 /remote.php/dav/; }

        location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

        return 301 /index.php$request_uri;
    }

    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)                { return 404; }

    location ~ \.php(?:$|/) {

        rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;

        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        set $path_info $fastcgi_path_info;

        try_files $fastcgi_script_name =404;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;

        fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice
        fastcgi_param front_controller_active true;     # Enable pretty urls
        fastcgi_pass unix:/run/php/php7.4-fpm_retractedinfo-nginx-socket_clouduser_nginx_socket.sock;

        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;

        fastcgi_max_temp_file_size 0;
    }

    location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463, $asset_immutabledev";
        access_log off;
        log_not_found off;

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }

    location ~ \.woff2?$ {
        try_files $uri /index.php$request_uri;
        expires 7d;
        access_log off;
        log_not_found off;
    }

    location /remote {
        return 301 /remote.php$request_uri;
    }

    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }

}

clouduser is user for process and owner of /home/clouduser/**

[cloud-nginx-socket]

user = clouduser
group = gclouduser

listen = /run/php/php7.4-fpm_retractedinfo-nginx-socket_clouduser_nginx_socket.sock

listen.owner = nginx
listen.group = nginx

pm = dynamic
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18

_depth = 20
slowlog = /home/clouduser/retractedinfo-www/logs/php/$pool.slow.log
request_slowlog_timeout = 30s
request_slowlog_trace_depth = 20

clear_env = no

php_admin_value[error_log] = /home/clouduser/retractedinfo-www/logs/php/$pool.error.log
php_admin_flag[log_errors] = on

php_admin_value[mbstring.func_overload] = 0
php_admin_value[always_populate_raw_post_data] = -1
php_admin_value[default_charset] = 'UTF-8'
php_admin_value[output_buffering] = 0

; WARP extras
php_admin_value[upload_max_filesize] = 32G
php_admin_value[post_max_size] = 32G
php_admin_value[memory_limit] = 2048M
php_admin_value[max_input_time] = 3600
php_admin_value[realpath_cache_size] = 64M
php_admin_value[max_execution_time] = 3600
php_admin_value[max_file_uploads] = 200
php_admin_value[default_socket_timeout] = 6000
php_admin_value[session.gc_maxlifetime] = 86400
php_admin_value[date.timezone] = Europe/Riga

Screenshot 2023-02-13 at 22 19 10

EDIT: I did not make any changes in .htaccess as nginx is used.

kroko commented 1 year ago

@CADViewer translated your provided Apache directive, seems to work now (placed before location ~ \.php(?:$|/))

    location /apps/cadviewer/converter/php/ {
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            set $path_info $fastcgi_path_info;
            try_files $fastcgi_script_name =404;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;
            fastcgi_param modHeadersAvailable true; 
            fastcgi_param front_controller_active true; 
            fastcgi_pass unix:/run/php/php7.4-fpm_retractedinfo-nginx-socket_clouduser_nginx_socket.sock;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
            fastcgi_max_temp_file_size 0;
        }
        try_files $uri $uri/ =403;
    }

Screenshot 2023-02-13 at 22 46 23

pureGavin commented 1 year ago

@CADViewer _翻译了_您提供的 Apache 指令,现在似乎可以工作(放在之前location ~ \.php(?:$|/)

    location /apps/cadviewer/converter/php/ {
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            set $path_info $fastcgi_path_info;
            try_files $fastcgi_script_name =404;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;
            fastcgi_param modHeadersAvailable true; 
            fastcgi_param front_controller_active true; 
            fastcgi_pass unix:/run/php/php7.4-fpm_retractedinfo-nginx-socket_clouduser_nginx_socket.sock;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
            fastcgi_max_temp_file_size 0;
        }
        try_files $uri $uri/ =403;
    }

屏幕截图 2023-02-13 在 22 46 23

how did you do? it's still doesn't work for me :(

kroko commented 1 year ago

@pureGavin

full nginx conf that can be used as an example


upstream cloudtest-php-handler {
    server unix:/run/php/php7.4-fpm_cloudtest-nginx-socket_clouduser_nginx_socket.sock;
}

server {
    listen 80;
    listen [::]:80;
    server_name yourcloud.fqdn.tld;
    return 302 https://$server_name:443$request_uri;
}

map $arg_v $asset_immutablecloud {
    "" "";
    default "immutable";
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    # ===========================================

    server_name  yourcloud.fqdn.tld;

    # ===========================================

    root /home/clouduser/cloudtest-www/live/public;

    # ===========================================

    ssl_certificate             /etc/letsencrypt/live/yourcloud.fqdn.tld/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/yourcloud.fqdn.tld/privkey.pem;
    ssl_dhparam                 /etc/nginx/yourcloudcustom-ssl_dhparam/ssl-dhparams-4096.pem;
    ssl_ecdh_curve              secp384r1;
    ssl_trusted_certificate     /etc/letsencrypt/live/yourcloud.fqdn.tld/chain.pem;
    ssl_stapling                on;
    ssl_stapling_verify         on;
    ssl_protocols               TLSv1.2;
    ssl_ciphers                 ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers   off;
    ssl_session_cache           shared:le_nginx_SSL:10m;
    ssl_session_timeout         1d;
    ssl_session_tickets         off;
    ssl_buffer_size             4k;

    # ===========================================

    server_tokens off;

    # ===========================================

    add_header Strict-Transport-Security "max-age=31536000" always;

    # ===========================================

    # set max upload size
    # align with PHP's upload_max_filesize and post_max_size
    client_max_body_size 32G;
    client_body_timeout 19200s;
    fastcgi_buffers 64 4K;

    # ===========================================

    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types
      application/atom+xml
      application/javascript
      application/json
      application/ld+json
      application/manifest+json
      application/rss+xml
      application/vnd.geo+json
      application/vnd.ms-fontobject
      application/wasm
      application/x-font-ttf
      application/x-web-app-manifest+json
      application/xhtml+xml
      application/xml
      font/opentype
      image/bmp
      image/svg+xml
      image/x-icon
      text/cache-manifest
      text/css
      text/plain
      text/vcard
      text/vnd.rim.location.xloc
      text/vtt
      text/x-component
      text/x-cross-domain-policy;

    # ===========================================

    client_body_buffer_size 512k;

    # ===========================================

    # Content-Security-Policy gets built by Nextcloud in the fly
    # add_header Content-Security-Policy "default-src *;";

    # Feature-Policy gets built by Nextcloud in the fly
    # add_header Feature-Policy "payment 'none'; usb 'none';";
    # Permissions-Policy is new name for Feature-Policy
    # add_header Permissions-Policy "microphone=(), camera=(), geolocation=(), payment=(), usb=()";

    add_header Referrer-Policy "no-referrer" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Download-Options "noopen" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "none" always;
    add_header X-XSS-Protection "1; mode=block" always;

    # ===========================================

    fastcgi_hide_header X-Powered-By;

    # ===========================================

    index index.php index.html /index.php$request_uri;

    location = / {
        if ( $http_user_agent ~ ^DavClnt ) {
            return 302 /remote.php/webdav/$is_args$args;
        }
    }

    location = /robots.txt {
        allow all;
        access_log off;
        log_not_found off;
    }

    location ^~ /.well-known {
        location = /.well-known/carddav { return 301 /remote.php/dav/; }
        location = /.well-known/caldav  { return 301 /remote.php/dav/; }

        location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

        return 301 /index.php$request_uri;
    }

    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)                { return 404; }

    location /apps/cadviewer/converter/php/ {

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            set $path_info $fastcgi_path_info;

            try_files $fastcgi_script_name =404;

            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;

            fastcgi_param modHeadersAvailable true;
            fastcgi_param front_controller_active true;
            fastcgi_pass cloudtest-php-handler;

            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;

            fastcgi_max_temp_file_size 0;
        }

        try_files $uri $uri/ =403;
    }

    location ~ \.php(?:$|/) {
        # Required for legacy support
        rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;

        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        set $path_info $fastcgi_path_info;

        try_files $fastcgi_script_name =404;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;

        fastcgi_param modHeadersAvailable true;
        fastcgi_param front_controller_active true;
        fastcgi_pass cloudtest-php-handler;

        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;

        fastcgi_max_temp_file_size 0;
    }

    location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463, $asset_immutablecloud";
        access_log off;
        log_not_found off;

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }

    location ~ \.woff2?$ {
        try_files $uri /index.php$request_uri;
        expires 7d;
        access_log off;
        log_not_found off;
    }

    location /remote {
        return 301 /remote.php$request_uri;
    }

    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }

}
Zhuangkh commented 1 year ago

@CADViewer translated your provided Apache directive, seems to work now (placed before location ~ \.php(?:$|/))

    location /apps/cadviewer/converter/php/ {
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            set $path_info $fastcgi_path_info;
            try_files $fastcgi_script_name =404;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;
            fastcgi_param modHeadersAvailable true; 
            fastcgi_param front_controller_active true; 
            fastcgi_pass unix:/run/php/php7.4-fpm_retractedinfo-nginx-socket_clouduser_nginx_socket.sock;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
            fastcgi_max_temp_file_size 0;
        }
        try_files $uri $uri/ =403;
    }

It works for me too, thanks

foxhoundv commented 1 year ago

Sorry, I will not be able to get this to work. I use HAProxy for my reverse proxy and at this point all the configuration stuff that I have had to do already to "make CADViewer work" and following all those directions. Now all this. I feel like this should be easier. Even OnlyOffice which has document access is pretty easy to set up. I am glad you guys made an app that has all these features but it shouldn't be this difficult to setup. Maybe sometime in the future but not at this time.

pureGavin commented 1 year ago

@pureGavin

full nginx conf that can be used as an example

upstream cloudtest-php-handler {
    server unix:/run/php/php7.4-fpm_cloudtest-nginx-socket_clouduser_nginx_socket.sock;
}

server {
    listen 80;
    listen [::]:80;
    server_name yourcloud.fqdn.tld;
    return 302 https://$server_name:443$request_uri;
}

map $arg_v $asset_immutablecloud {
    "" "";
    default "immutable";
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    # ===========================================

    server_name  yourcloud.fqdn.tld;

    # ===========================================

    root /home/clouduser/cloudtest-www/live/public;

    # ===========================================

    ssl_certificate             /etc/letsencrypt/live/yourcloud.fqdn.tld/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/yourcloud.fqdn.tld/privkey.pem;
    ssl_dhparam                 /etc/nginx/yourcloudcustom-ssl_dhparam/ssl-dhparams-4096.pem;
    ssl_ecdh_curve              secp384r1;
    ssl_trusted_certificate     /etc/letsencrypt/live/yourcloud.fqdn.tld/chain.pem;
    ssl_stapling                on;
    ssl_stapling_verify         on;
    ssl_protocols               TLSv1.2;
    ssl_ciphers                 ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers   off;
    ssl_session_cache           shared:le_nginx_SSL:10m;
    ssl_session_timeout         1d;
    ssl_session_tickets         off;
    ssl_buffer_size             4k;

    # ===========================================

    server_tokens off;

    # ===========================================

    add_header Strict-Transport-Security "max-age=31536000" always;

    # ===========================================

    # set max upload size
    # align with PHP's upload_max_filesize and post_max_size
    client_max_body_size 32G;
    client_body_timeout 19200s;
    fastcgi_buffers 64 4K;

    # ===========================================

    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types
      application/atom+xml
      application/javascript
      application/json
      application/ld+json
      application/manifest+json
      application/rss+xml
      application/vnd.geo+json
      application/vnd.ms-fontobject
      application/wasm
      application/x-font-ttf
      application/x-web-app-manifest+json
      application/xhtml+xml
      application/xml
      font/opentype
      image/bmp
      image/svg+xml
      image/x-icon
      text/cache-manifest
      text/css
      text/plain
      text/vcard
      text/vnd.rim.location.xloc
      text/vtt
      text/x-component
      text/x-cross-domain-policy;

    # ===========================================

    client_body_buffer_size 512k;

    # ===========================================

    # Content-Security-Policy gets built by Nextcloud in the fly
    # add_header Content-Security-Policy "default-src *;";

    # Feature-Policy gets built by Nextcloud in the fly
    # add_header Feature-Policy "payment 'none'; usb 'none';";
    # Permissions-Policy is new name for Feature-Policy
    # add_header Permissions-Policy "microphone=(), camera=(), geolocation=(), payment=(), usb=()";

    add_header Referrer-Policy "no-referrer" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Download-Options "noopen" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "none" always;
    add_header X-XSS-Protection "1; mode=block" always;

    # ===========================================

    fastcgi_hide_header X-Powered-By;

    # ===========================================

    index index.php index.html /index.php$request_uri;

    location = / {
        if ( $http_user_agent ~ ^DavClnt ) {
            return 302 /remote.php/webdav/$is_args$args;
        }
    }

    location = /robots.txt {
        allow all;
        access_log off;
        log_not_found off;
    }

    location ^~ /.well-known {
        location = /.well-known/carddav { return 301 /remote.php/dav/; }
        location = /.well-known/caldav  { return 301 /remote.php/dav/; }

        location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

        return 301 /index.php$request_uri;
    }

    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)                { return 404; }

    location /apps/cadviewer/converter/php/ {

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            set $path_info $fastcgi_path_info;

            try_files $fastcgi_script_name =404;

            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;

            fastcgi_param modHeadersAvailable true;
            fastcgi_param front_controller_active true;
            fastcgi_pass cloudtest-php-handler;

            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;

            fastcgi_max_temp_file_size 0;
        }

        try_files $uri $uri/ =403;
    }

    location ~ \.php(?:$|/) {
        # Required for legacy support
        rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;

        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        set $path_info $fastcgi_path_info;

        try_files $fastcgi_script_name =404;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;

        fastcgi_param modHeadersAvailable true;
        fastcgi_param front_controller_active true;
        fastcgi_pass cloudtest-php-handler;

        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;

        fastcgi_max_temp_file_size 0;
    }

    location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463, $asset_immutablecloud";
        access_log off;
        log_not_found off;

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }

    location ~ \.woff2?$ {
        try_files $uri /index.php$request_uri;
        expires 7d;
        access_log off;
        log_not_found off;
    }

    location /remote {
        return 301 /remote.php$request_uri;
    }

    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }

}

i install nextcloud by docker, so was CADViewer. So, where can i find Nginx config file?