Skip to main content

Command Palette

Search for a command to run...

Linux Basic web server command

Updated
3 min read
Linux Basic web server command

It looks like you've provided a sequence of commands and explanations from your terminal session.

  1. sudo ufw status

    • Checks the status of the Uncomplicated Firewall (UFW), displaying current rules and whether it is active or not.
    sudo ufw status
  1. sudo ufw allow ssh

    • Allows incoming SSH connections through the firewall, enabling secure remote access to the system.

        sudo ufw allow ssh
      
  2. sudo ufw allow 'Nginx Full'

    • Opens up ports necessary for Nginx to operate with its full feature set, typically allowing HTTP (port 80) and HTTPS (port 443) traffic.

        sudo ufw allow 'Nginx Full'
      
  3. sudo ufw enable

    • Enables the UFW firewall, activating the rules you've configured to regulate incoming and outgoing network traffic.

        sudo ufw enable
      
  4. sudo ufw status

    • Verifies the firewall's status post-enabling, confirming which ports and services are allowed or denied.

        sudo ufw status
      
  5. sudo systemctl stop nginx

    • Stops the Nginx web server, halting its operation.

         sudo systemctl stop nginx
      
  6. sudo systemctl start nginx

    • Starts the Nginx web server, initiating its operation.

        sudo systemctl start nginx
      
  7. sudo systemctl restart nginx

    • Restarts the Nginx web server, applying any configuration changes or updates.

        sudo systemctl restart nginx
      

sudo systemctl status nginx

  • Checks the current status of the Nginx service, confirming if it's running, stopped, or encountering issues.

      sudo systemctl status nginx
    

sudo systemctl enable nginx

  • Configures Nginx to start automatically when the system boots up, ensuring it runs as a service.

      sudo systemctl enable nginx
    

ls

  • Lists the files and directories in the current directory.

      ls
    

ls -lrp

  • Lists files and directories in long format, showing details such as permissions, ownership, and file types, and appends / to directories.

  •   ls -lrp
    
  • cd /var/www/html

  • Changes the current directory to /var/www/html, typically where web files for Nginx or Apache are stored.

  •   cd /var/www/html
    

pwd

  • Prints the current working directory.

      pwd
    

echo "helloworld"

  • Prints "helloworld" to the terminal output.

      echo "helloworld"
    

touch index.html

  • Creates an empty file named index.html in the current directory.

      touch index.html
    

sudo touch index.html

  • Attempts to create an empty file named index.html with superuser privileges, but may fail due to permissions.

      sudo touch index.html
    

sudo echo "Helloworld" > index.html

  • Writes "Helloworld" into the index.html file using elevated privileges, overwriting its content if the file exists.

      sudo echo "Helloworld" > index.html
    

sudo vi index.html

  • Opens the index.html file in the Vi text editor with superuser privileges, allowing editing of its contents.

      sudo vi index.html
    

sudo rm index.html

  • Removes (deletes) the index.html file from the current directory with superuser permissions.

      sudo rm index.html
    

These commands cover firewall management (ufw), web server control (nginx), file system navigation and manipulation, and basic file operations in a Unix-like environment. Each command serves a specific purpose related to system administration and web development tasks.