0

I have a file system directory(files and folders) in a google cloud platform virtual machine as a mounted disk. I wanted those files should share across all other applications to access those files.

VM OS - Debian 9

I've tried:

Thought using Nginx server to share the files like - http:// IP Address/path/to/file.pptx configuration file

server {
    listen 8080 default_server;
    listen [::]:8080 default_server;
    server_name <IP Address>;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
    root   /<mounted file path>;
        index  index.html index.htm;
    try_files $uri $uri/ =404;
    }

}

Things are working as I expected, getting 404 error when try to access using this URL - http:// IP Address/path/to/file.pptx

Actually I have no clue how to access those files. I would appreciate it if someone helps me out with a right solution.

  • 1
    What do nginx log files tell? – Tero Kilkanen Jul 10 '20 at 15:10
  • 1
    Are there any limitations for the sharing method and files location? For example, do the shared files have to be located on the VM instance persistent disk? If so, will SMB, FTP, or SSH be acceptable to access them, or only HTTP? If there's no requirement to store files on the VM instance disk, can using of a Cloud Storage bucket be a solution? – mebius99 Jul 10 '20 at 16:36

1 Answers1

1

You need to make sure that your firewalls are setup properly, so that the files are not open to all internet.

You should also consider using TLS encryption.

You should also use domain names instead of IP addresses, since IP addresses can change.

What becomes to your actual issue: With your configuration, you need to use http://<IP address>:8080/path/to/file.pptx to access a file on this server.

An alternative is to change listen directive to port 80. Then you need to make sure there aren't other default_server blocks in your configuration.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • Hi Tero - Thanks for your reply. I am using internal IP in a VPC network to prevent outsiders to access that. However, I am able to access if I run the command `python -m SimpleHTTPServer 8080`. Unable to access using Nginx, is there any configuration I have missed out? – justAnAnotherCoder Jul 10 '20 at 07:14