Basic Commands for Ubuntu Server with NGINX Web-server Installed

There is no doubt that NGINX is the easiest and the fastest open source web server out there in the market right now. Let’s look into some basic Linux Ubuntu command line commands.

ubuntu server with NGINX

The command to a switch user (in this case Smith):

$ su - smith

List of all users with a home directory

$ cat /etc/passwd | grep /home | cut -d: -f1


List of all users with or without a home directory

$ compgen -u

Change password (user is username)

$ passwd user

 

Code for 302 Redirection in NGINX Config file

location = /blog/what-is-seo-uses-of-seo/

{   

return 302 /blog/how-seo-can-make-a-difference;   

}

 

The actual web content, which by default only consists of the default Nginx page, is served out of the /var/www/html directory. This can be changed by altering Nginx configuration files.

$ cd /var/www/html

 

The Nginx configuration directory. All of the Nginx configuration files reside here:

$ cd /etc/nginx 

The main Nginx configuration file. This can be modified to make changes to the Nginx global configuration.

$ cd /etc/nginx/nginx.conf 

 

The directory where per-site “server blocks” can be stored. Nginx will not use the configuration files found in this directory unless they are linked to the sites-enabled directory (see below).

Typically, all server block configuration is done in this directory, and then enabled by linking to the other directory

$ cd /etc/nginx/sites-available/

The directory where enabled per-site “server blocks” are stored.

Typically, these are created by linking to configuration files found in the sites-available directory

$ cd /etc/nginx/sites-enabled/

 

This directory contains configuration fragments that can be included elsewhere in the Nginx configuration. Potentially repeatable configuration segments are good candidates for refactoring into snippets

$ cd /etc/nginx/snippets

 

Every request to your web server is recorded in this log file unless Nginx is configured to do otherwise

$ cd /var/log/nginx/access.log

 

Any Nginx errors will be recorded in the log

$ cd /var/log/nginx/error.log

Reboot ubuntu

sudo reboot

 

Linux CPU speed test score

$ sudo apt install sysbench

$ sysbench --test=cpu run

 

Linux Memory speed test score

$ sudo apt install sysbench

$ sysbench --test=memory run

 

Linux I/O speed test score

$ sudo apt install sysbench

$ sysbench --test=fileio --file-test-mode=seqwr run

 

Switch to Root permissions

$ sudo su

 

View system log file

$ /var/log/syslog

 

View Cron Jobs

$ crontab -l

 

Edit Cron Jobs

$ crontab -e

It may be noted that Atom is the best editor to edit shell session files like conf files, while putty or Chrome SSH extensions can be used to access shell session.

You may also like...