1- Install Nginx on Ubuntu using the package manager. Run the following command in the terminal to install Nginx:
sudo apt-get update
sudo apt-get install nginx
2- Create a directory to store the files you want to serve. For example, you can create a directory named "files" in the Nginx root directory using the following command:
sudo mkdir /var/www/html/files
3- Grant read and write permissions to the Nginx user (which is usually "www-data") for the "files" directory:
sudo chown -R www-data:www-data /var/www/html/Software
sudo chmod -R 755 /var/www/html/Software
4- Configure Nginx to serve the files. Open the default configuration file using a text editor:
sudo nano /etc/nginx/sites-available/default
Find the location / block and add the following directives inside it to configure Nginx to serve files from the "files" directory:
location /files {
autoindex on;
alias /var/www/html/files/;
}
This tells Nginx to enable directory listing and serve files from the "files" directory.
5- Save and exit the file, then restart Nginx:
sudo systemctl restart nginx
#ubuntu #linux #linux_tutorial #hinditutorials #how #vbox7 #trending