• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Question What web server does the Plesk interface use / MIME types / .glb

Paul Larson

Basic Pleskian
Server operating system version
Centos 6
Plesk version and microupdate number
18.0.70 Update #2
Is it Apache? The same Apache a Plesk server's websites/subscription would use?

One reason I ask, is the Plesk File Manager for a domain allows a .glb (model) file upload - but for the life of me, I can't get my CMS to allow an upload of the same file.

If both Plesk, and my website, were Apache, that would be an interesting troubleshooting exercise.

Plesk Mime Type is set as:

model/gltf-binary .glp

mime.png
 
If you have proxy mode enabled under the nginx settings then it's using Apache, otherwise it's using Nginx, of course that could also depends on how you have your PHP configured if you're using PHP for your CMS and if you have proxy mode enabled since you can choose to have the PHP served by Apache or by Nginx with Proxy Mode enabled.

As for file uploads to your CMS, you might want to refer to the documentation of the CMS you're using since a lot of the times they will block a lot of file types by default and you would need to configure it to allow such file types. Another thing to look at is max upload size and as well and need to make sure the domain settings allows whatever max size you allow and for the PHP settings as well (again, if the CMS you're using is PHP. I'm just making an assumption here since you didn't specific what CMS you're using nor if it's using PHP or not so I'm including it to cover the bases).
 
If I leave the CMS out of the picture - and just use PHP, I still don't get proper MIME treatment of .glb files.
However, the command like 'file' command works as expected.

Example:

Code:
-bash-4.2$ file Duck.glb
Duck.glb: model/gltf-binary

Apache/Nginx see the.glb files as 'application/octet-stream'

Example PHP:

PHP:
<?php
/*
Duck.glb
nms-8-8_19-jcs.glb
parshall-flume.glb
pmm-4-d-p9-18p-n-s-n-t_1.glb
*/

$testFiles = [
    '300x250.jpg' => 'JPEG image',
    'dnib.png' => 'PNG image',
    'HBE_BodyTech.pdf' => 'PDF document',
    'RECORDINGS.docx' => 'Microsoft Word',
    'jcogs_cdm_1_0_4_1.zip' => 'ZIP archive',
    'addca-order-summary.csv' => 'Text file',
    'Duck.glb' => 'GLB File',
    'nms-8-8_19-jcs.glb' => 'GLB File',
    'parshall-flume.glb' => 'GLB File',

];

echo "<pre>";
$finfo = new finfo(FILEINFO_MIME_TYPE);

foreach ($testFiles as $file => $description) {
    if (file_exists($file)) {
        $mime = $finfo->file($file);
        echo "$description ($file): $mime\n";
    } else {
        echo "$description ($file): File not found.\n";
    }
}


echo "</pre>";
echo "<hr>";
$finfo = new finfo(FILEINFO_MIME_TYPE);
echo $finfo->file('Duck.glb');

?>
Output is:

Code:
JPEG image (300x250.jpg): image/jpeg
PNG image (dnib.png): image/png
PDF document (HBE_BodyTech.pdf): application/pdf
Microsoft Word (RECORDINGS.docx): application/vnd.openxmlformats-officedocument.wordprocessingml.document
ZIP archive (jcogs_cdm_1_0_4_1.zip): application/zip
Text file (addca-order-summary.csv): text/plain
GLB File (Duck.glb): application/octet-stream
GLB File (nms-8-8_19-jcs.glb): application/octet-stream
GLB File (parshall-flume.glb): application/octet-stream
----
application/octet-stream

I've compiled an addition to the server's magic file.. I've added the model/gltf-binary glb mime type properly in many places on the server, based on numerous Plesk articles.
 
Assuming you're using PHP, there isn't anything on a Plesk server, whether using Apache or Nginx, that sets a restriction on what type of file you can upload. Any upload restriction is the result of a limitation in the code (of your CMS) that you're using. Whether or not you've defined a mime type for the file extension does not influence the upload process (unless it's coded that way in your CMS).

For testing purposes you can create a PHP file using this (poor) code example to create an upload page. This should demonstarte that there is no restrcition on upload an GLB fule.

I recommend using this code in a password protected directory only and to deleted after your done with testing. Because it leaves your webspace (and in extension your server) open for abuse.
PHP:
<!DOCTYPE html>
<html>
<body>

<form action="?upload" method="post" enctype="multipart/form-data">
  Select image to upload:
  <input type="file" name="uploaded_file" id="uploaded_file">
  <input type="submit" value="Upload" name="submit">
</form>

</body>
</html>
<?php
  if(!empty($_FILES['uploaded_file']))
  {
    $path = basename( $_FILES['uploaded_file']['name']);

    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
      echo "The file ".  basename( $_FILES['uploaded_file']['name']).
      " has been uploaded";
    } else{
        echo "There was an error uploading the file, please try again!";
    }
  }
?>
 
Both a php file run through the CMS, and a standalone PHP (not run through CMS but run through web space/Plesk) report MIME type: application/octet-stream for a glb file in the filesystem.
 
Note that you've defined the file extension here with a p at the end, instead if a b. (Regardless, setting the mime type in Apache won't affect how PHP recognizes the extension.)
Thanks - that typo is only in the forum post. It's correct in the Plesk settings.
 
You may need to define the mime type in Apache and Nginx, I had to do the same with .webmanifest files, create the file...

nano /etc/apache2/conf-available/add-types.conf

adding...

AddType model/gltf-binary .glp

then run this command to enable it...

a2enconf add-types.conf

And restart Apache.

then you need to edit...

/etc/nginx/mime.types

adding...

model/gltf-binary .glp;

And restart nginx.

That should do it. I hope it helps.
Regards

LD

Edit: Just seen you are using Centos so paths may be incorrect.
 
Back
Top