1)
ubuntu
$) sudo bash
$) apt-get update
$) apt-get install -y dotnet-sdk-9.0
$) apt-get install -y aspnetcore-runtime-9.0
$) apt-get install -y dotnet-runtime-9.0
$) dotnet --info
$) apt-get install nginx

windows
net 9 bundle.
Windows Hosting Bundle Installer!

Copy the Files to the Linux Server
Next, we need to copy the deployment files to the Ubuntu server. Before we move the files,
let’s create the destination folder on the server and set the permissions 
so that we can add files to it:

$) cd /var/www
$) sudo mkdir app
$) sudo chmod 777 app

Run the App on a Kestrel Web Server
In a terminal, navigate to the deployment path and run the app in Kestrel:
cd /var/www/app
sudo dotnet DeployingToLinuxWithNginx.dll

//edit nginx config file
$ sudo nano /etc/nginx/sites-avaible/default

 location / {
        proxy_pass         http://127.0.0.1:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
   }
   
   sudo nginx -t
   sudo nginx -s reload
   
   To create the service, we first need to create the configurations in a systemd unit file. 
   The unit file contains information regarding the unit, which is a service in this case. 
   For services, it should have the .service extension and contain some
    information about the service. These files are required to be in the 
    /etc/systemd/system directory.
   
   Let’s use “nano” to create the unit file and name it kestrel-app.service:
   
   [Unit]
   Description=ASP.NET Core Web App running on Ubuntu
   [Service]
   WorkingDirectory=/var/www/app
   ExecStart=/usr/bin/dotnet /var/www/app/DeployingToLinuxWithNginx.dll
   Restart=always
   # Restart service after 10 seconds if the dotnet service crashes:
   RestartSec=10
   KillSignal=SIGINT
   SyslogIdentifier=dotnet-web-app
   # This user should exist on the server and have ownership of the deployment directory
   User=www-data
   Environment=ASPNETCORE_ENVIRONMENT=Production
   [Install]
   WantedBy=multi-user.target
   
   After adding the content, save it. Then let’s enable and start the service:
   sudo systemctl enable kestrel-app.service
   sudo systemctl start kestrel-app.service
   put familytreeapp.conf 
   
   put in /etc/nginx/sites-availalble/familytreeapp.conf
   $) sudo ln -s /etc/nginx/sites-available/familytreeapp.conf /etc/nginx/sites-enabled/

   postgresql.conf:
   
       Edit postgresql.conf:
           Locate the postgresql.conf file, typically in /etc/postgresql/<version>/main/postgresql.conf.
           Change the listen_addresses parameter to '*' to allow connections from any IP address, or specify the IP address(es) you want to allow.
           ```
   
   listen_addresses = '*'
   
   
   Locate the postgresql.conf file within the container (e.g., /etc/postgresql/<version>/main/postgresql.conf).
   Modify listen_addresses:
   Change listen_addresses = 'localhost' to listen_addresses = '*' to allow connections from any IP address.
    Alternatively, specify the container's IP address.
    
        host    all     all     0.0.0.0/0       md5
   pg_hba.conf
   
    **Edit `pg_hba.conf`:**
       *   Locate the `pg_hba.conf` file, typically in `/etc/postgresql/<version>/main/pg_hba.conf`.
       *   Add a line to allow connections from your desired network or specific IP addresses. For example, to allow connections from any IP address on the network using MD5 authentication:
       *   ```
       host    all             all             0.0.0.0/0               md5
       
   
   setup password for postgresql
    sudo -u postgres psql
    postgres=# 
    then type \password postgres
    
    docker run -p 5432:5432 -e POSTGRES_PASSWORD=123456789 \
     -d postgres:9.3.6 \
     -c config_file=/path/to/postgresql.conf
     
     
     