Simple Web Server to Host Simple Files

Hi
I have an VPS that has MikroTik CHR installed on it.
I want a simple Web Server to host my files in specific directories on this CHR.
I need to access these files and Download them with direct Domain Address (I created a DNS Record that is Point this VPS Public IP Address already) like this for example :

http(s)://sub.domain.com/dir/file.(txt)

Or something like that.

I know CHR is not meant to be a Web Server for such purposes,
But I need this for my personal use.
I would be appreciated if anyone help or guide me if there are any possible solutions.
Thanks

I would recommend using wireguard to enter the VPS and access the files as the most secure method!

Thanks, But these files are not sensitive.
I need to access the via direct link and no authentication to access them
Is it possible?

Of course, the CHR can provide the Port forwarding required.

How can I do that?
Sorry, I’m very new to MikroTik.
I would be appreciated describe what exactly should I do this to obtain my purpose.
Thanks.

https://www.youtube.com/watch?v=pmyVQS93HMM

I watched this video before, But I want to access these file through Internet without authentication and connect to MikroTik network
Only using a Domain Link and some custom driectories
Something like this :

https://sub.domain.com/dir/file.txt

Mikrotik has nothing built-in to server static files from a directory.

But, you can install nginx or lighttpd as a container, and use a mount to link the http server container’s www directory, to Mikrotik path.

A more modern approach might be use caddyserver container, slightly more complex in some ways, but deals with SSL certs more automatically & simplier if you need to proxy web traffic.
https://caddyserver.com with specifically
https://caddyserver.com/docs/caddyfile/patterns#static-file-server

For DNS, that be on you to define in your domain record so it point to VPS Mikrotik… or you can use the /ip/cloud name as the https:// host.

You can also add a simple web server on a computer (your preferred flavor of OS), or even a RaspBerry Pi on the LAN and port forward via NAT so it can be reached from the Internet.

You don't have to have any AUTH if you don't want to.
Pull the nginx image, duplicate your files into the mounted directory, run the instance, and next create a dst-nat rule which forwards the 80/TCP port to your container instance. Then, create a CNAME record with the content of your DDNS. If you want an HTTPS connection, then you could use Let Encrypt to create a valid certificate. However, you can utilize the Cloudflare CDN service.

The question started with: I have an VPS that has MikroTik CHR installed on it.
So to do it that way he would have to buy yet another VPS, probably not what he had in mind.

It seems that configuring “hotspot” installs a simple webserver, but I do not have experience with it to tell how useful it is.

Check this:
https://mikrotik.xyz/mikrotik/mikrotik-hosting-docker/
Quote:
"
Web hosting with MikroTik and Docker Hub Containers

Attention MikroTik enthusiasts! It’s time to explore the world of Containers! MikroTik’s implementation of Linux containers allows users to run containerized environments within RouterOS. This feature was introduced in version 7 of the operating system.

Personally, I’ve decided to leverage my MikroTik Cloud Hosted Router (CHR) to host my WordPress blog, complete with a multisite network. […]
"

Thank you So Much, This was exactly what I want

have someone test for make https for web server use letencrypte ssl?

You might also want to take a look at Caddyserver or Trafik container if it’s just static files (e.g. you don’t need Wordpress etc for content mgmt). Both have ACME built-in with Let’s Encrypt support in the container that largely automatic. See http://forum.mikrotik.com/t/container-traefik-on-rb5009/165849/6 for traefik. I don’t have writeup for caddyserver, but works on RouterOS container.

What I would do is create a Wireguard tunnel between the VPS and the mikrotik router.
The server and files would be hosted on the Mikrotik Router.
On the CHR I would port forward inquiries coming in externally from USers or in this case just the admin, to the VPS public IP or domain name/url etc…
They would be port forwarded into the tunnel,
DONE.

Assuming server is 192.168.0.25 and port 10101 on the MT router.

VPS
/wireguard interface
add name=wireguard-vps listening port=15444
/ip address
add address=10.10.10.1/24 interface=wireguard-vps network=10.10.10.0
/wireguard
allowed-ips=10.10.10.2/32,192.168.0.0/24 interface=wireguard-vps public-key=“” { add additional subnets on the MT as required } PEER MT ROUTER
allowed-ips=10.10.10.3/32 interface=wireguard-vps public-key=“” PEER ADMIN LAPTOP
allowed-ips=10.10.10.4/32 interface=wireguard-vps public-key=“” PEER ADMIIN IPHONE

/ip route
add dst-address=192.168.0.0/24 gateway=wireguard-vps routing-table=main

/ip firewall ( complete set of default rules except replace the forward chain rule associated with port forwarding to )
add action=accept chain=forward connection-nat-state=dstnat comment="allow port forwarding"add action=accept chain=forward in-interface=wireguard-vps out-interface=wireguard-vps comment=“relay for remote users to MT Router”
add action=accept chain=forward in-interface-list=wireguard-vps out-interface-list=WAN
{ allows remote users or users on MT to use VPS internet if required }
add action=drop chain=forward comment=“Drop all else”

Probably want to also add an input chain rule
add chain=input action=accept in-interface=wireguard-vps comment='remote or MT Router admin config access to VPS"

/ip firewall nat
add chain=srcnat action=scrnat out-interface=wan to-address=static VPS public IP
add chain=dstnat action=dst-nat dst-address=vps public IP dst-port=10101 protocol=tcp to-address=192.168.0.25

+++++++++++++++++++++++++++++++++++++++++++++++++++++

MT Router
/wireguard interface
add name=wireguard-vps listening port=10222
/ip address
add address=10.10.10.2/24 interface=WG network=10.10.10.0
/wireguard
allowed-ips=0.0.0.0/0 interface=WG public-key=“” endpoint=DOMAINNAME endpoint-port=15444 persistent-keep-alive=30s

/ip firewall
add chain=input action=accept in-interface=WG comment=“allow remote admin IPs to config router”
add chain=forward action=accept in-interface=WG out-interface-list=LAN comment=“Remote access to local LANs/Server”
add chain=forward action=accept src-address-list=ADMIN out-interface=WG comment=“allow local admin IPs to tunnel”