Héberger un site web sur TrueNAS

Solved
Dwkil -  
 Dwkil -
Hello, I just installed TrueNas on my old PC. I want to host a website on it but I don't know which plugins to use and how to use them.

Any kind souls to help me please? :)

2 answers

  1. avion-f16 Posted messages 19182 Registration date   Status Contributor Last intervention   4 513
     
    Hello,

    I advise against hosting applications directly on the NAS, but that's not the point...

    Since TrueNAS is based on FreeBSD, it's possible to create jails. Jails in FreeBSD are like LXC containers in Linux, meaning they are isolated execution environments that share the host system's kernel while isolating the file system, network namespace, processes, users, etc. In practice, this allows for nearly the same functionality as virtual machines but with better performance (because there's no virtualization) while having the limitation of using the host kernel within the container/jail.

    If you prefer to use FreeBSD as the OS for your web server, the best approach is to create a jail from TrueNAS. You can create a "bind volume" to associate a folder on TrueNAS (the one containing the site) with a folder in the jail. Regarding the network configuration, the jail should be set to "NAT" mode, and in order to access the jail from your LAN, you will need to forward a port from the NAS to the jail. Ports 80/443 on the NAS are already used by the TrueNAS web interface, so you'll need to choose a different port. Apache (in the jail) can run on port 80, no issues there. So you can create this port forwarding: nas:8080 -> jail:80
    Once the jail is running, you can enter its shell and you'll find a FreeBSD system with its own utilities/commands to install Apache and the other necessary tools. The rest of the configuration does not involve TrueNAS anymore, so you can follow a tutorial for setting up a web server on FreeBSD in general, without looking for a specific tutorial just because you're on TrueNAS.

    If you want to install the web server on another OS like Linux or Windows, you'll need to create a virtual machine.
    1
    1. Dwkil
       
      Thank you for your valuable help, I know it’s not the best but it’s for a final project. I just need to explain how to host a website on a NAS. Since I've never dealt with a NAS before, I’ll try to manage. I also saw that there are plugins, do I need to use that for hosting as well?
      0
      1. avion-f16 Posted messages 19182 Registration date   Status Contributor Last intervention   4 513 > Dwkil
         
        When installing a plugin, TrueNAS creates a jail and proceeds to install the packages and import the files as established in the corresponding git repository. The TrueNAS documentation explains how to create a plugin if you want to see how it's done.


        Can you specify the studies you followed?

        For example, if you are a Web developer, I can understand that you may be asked to set up a Web server and that you turn to this kind of discouraged solutions. What I find hard to understand is why you are being advised to use a NAS when, as a Web developer, you shouldn't be responsible for setting up the Web server or managing the storage system.

        However, if you are studying something that focuses more on server/storage/network administration, I advise against using "one-click" solutions that will be dependent on the system installed on the NAS and are aimed at the geek/tinkerer who wants to self-host without really knowing how to configure a Web server. Instead, I suggest creating a FreeBSD jail or a Linux VM to demonstrate that 1) you can install TrueNAS and get acquainted with its features 2) you master the deployment of Web services (Apache, PHP, MySQL, ...) on any FreeBSD or Linux system, without depending on the NAS system.
        0
  2. Dwkil
     
    I am studying to become an IT technician, and I chose the topic for my final project. I thought it wasn't that complicated, that I just had to pay for the domain name and configure a redirect with the NAS.
    0