Can you edit the /etc/nginx/custom_configuration.conf file with SciTE? Describe the process below. Remember, because the file is stored under /etc, you will need root permissions to edit it.
Editing Configuration Files for Services
a. First, open nginx’s configuration file in a nano. The configuration filename used here is custom_server.conf. Notice below that the command is preceded by the sudo command. After typing nano include a space and the -l switch to turn on line-numbering.
[analyst@secOps ~]$ sudo nano -l /etc/nginx/custom_server.conf
[sudo] password for analyst:
Use the arrow keys to navigate through the file.
GNU nano 2.8.1 File: /etc/nginx/custom_server.conf
#user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local]
"$request$
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 81;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
^G Get Help ^O Write Out ^W Where Is ^K Cut Text ^J Justify ^C Cur Pos
^X Exit ^R Read File ^\ Replace ^U Uncut Text^T To Spell ^_ Go To Li
b. While the configuration file has many parameters, we will configure only two: the port nginx listens on for incoming connections, and the directory it will serve web pages from, including the index HTML homepage file.
c. Notice that at the bottom of the window, above the nano commands, the line number is highlighted and listed. On line 36, change the port number from 81 to 8080. This will tell nginx to listen to HTTP requests on port TCP 8080.
d. Next, move to line 44 and change the path from /usr/share/nginx/html/ to /home/analyst/ lab.support.files/
e. Press CTRL+X to save the file. Press Y and then ENTER to confirm and use the custom_server.conf as the filename.
f. Type the command below to execute nginx using the modified configuration file:
[analyst@secOps ~]$ sudo nginx -c custom_server.conf -g "pid /var/run/nginx_v.
pid;"
g. Click the web browser icon on the Dock to launch Firefox.
h. On the address bar, type 127.0.0.1:8080 to connect to a web server hosted on the local machine on port 8080. A page related to this lab should appear.
i. After successfully opening the nginx homepage, look at the connection message in the terminal window.
j. To shut down the nginx web server, press ENTER to get a command prompt and type the following command in the terminal window:
[analyst@secOps ~]$ sudo pkill nginx
k. You can test whether the nginx server is indeed shut down by first clearing the recent history in the web browser, then close and re-open the web browser, then go to the nginx homepage at 127.0.0.1:8080.
From a terminal window, issue sudo scite /etc/nginx/custom_configuration.conf to launch scite as root.
You might also like to view...
What virtual NIC hardware acceleration option enhances the virtual network adapter's performance by allowing a virtual adapter to bypass the virtual switch software on the parent partition?
A. Virtual machine queue B. Single-root I/O virtualization C. IPsec task offloading D. Single-root buffering
Based on their study of a group of programmers, the best programmers are ________ times more productive than the worst ones.
A) one to two B) three to five C) four to eight D) five to ten