Learn to build Nginx environment, you must configure the nginx.conf file, as follows:
#user nobody;
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 80;
server_name localhost;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Location/{
root HTML;
Index index.html index.htm;
}
In general, we are beginners, it is impossible to suddenly put the configuration files out. To understand each module, the comments section can be removed first, then you can use this command to exclude # and empty lines
Grammar
Grep-v ' #|^$ ' filename
Egrep-v ' #|^$ ' filename
Role of the command
grep, Egrep, fgrep-print lines matching a pattern
Parameters:
-V,--invert-match exclusion
-E,--extended-regexp
Egrep-i ' devops ' file does not consider the case of Sam, which contains a row of Sam.
Egrep-l "Dear Ken" * contains a list of all Dear Ken's files.
Egrep-n Tom file contains Tom's rows, with line numbers prepended to each line.
Egrep-s "$name" file finds the variable name $name, but does not print but shows the exit status. 0 means found. 1 indicates that the expression was not found to meet the requirements, and 2 indicates that the file was not found.
Instance:
[Email protected] conf]#egrep-v ' #|^$ ' nginx.conf.default > nginx.conf
[email protected] conf]# cat nginx.conf
Worker_processes 1;
Events {
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
Sendfile on;
Keepalive_timeout 65;
server {
Listen 80;
server_name localhost;
Location/{
root HTML;
Index index.html index.htm;
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
}
}
After removing the comment # and the empty line, it looks much more comfortable.
This article is from the "Pcjazz" blog, make sure to keep this source http://520527.blog.51cto.com/510527/1880719
Linux command Accumulation egrep command