Nginx.conf weight loss

Label Nginxsplit
1689 people read comment(1) Collection Report

Issues, nginx.conf file is too long, too large, inconvenient maintenance, so want to split up, so good to read or maintain.

1, the nginx inside the configuration of all stripped out of the Weixin

As follows, this is the nginx.conf profile in the micro channel configuration records, the future will be more and more.

Location ^/weixin_g1.*${*

Http: proxy_pass//weixin_web_9600;

Logs/weixin_g1_error.log error error_log;
Logs/weixin_g1_access.log main access_log;


Location ^/weixin_g2.*${*

Http: proxy_pass//weixin_web_9600;

Logs/weixin_g2_error.log error error_log;
Logs/weixin_g2_access.log main access_log;


Location ^/weixin_g3.*${*

Http: proxy_pass//weixin_web_9600;

Logs/weixin_g3_error.log error error_log;
Logs/weixin_g3_access.log main access_log;


Location ^/weixin_g4.*${*

Http: proxy_pass//weixin_web_9600;

Logs/weixin_g4_error.log error error_log;
Logs/weixin_g4_access.log main access_log;


2, the configuration of the Weixin to re generate a file weixin.conf

Nginx.conf VIM
Then enter: edit the line, enter the 312363 weixin.conf, and then enter, you will generate a new file, as shown below:

[root@nginx_service data# VIM /tmp/nginx.conf

  Two Nginx nginx #user;
  Five Logs/error.log #error_log;
 Thirty-six       Server TenXX.1.211:Eight thousandMax_fails=FiveFail_timeout=ThirtyS;
 Thirty-seven       Server TenXX.1.212:Six thousand and one hundredMax_fails=FiveFail_timeout=ThirtyS;
 Thirty-eight       Server TenXX.1.215:Seven thousand and one hundredMax_fails=FiveFail_timeout=ThirtyS;
 Thirty-nine       Server TenXX.1.216:Seven thousandMax_fails=FiveFail_timeout=ThirtyS;
:Three hundred and twelve,Three hundred and sixty-threeWOneConf

PS: the original blog address:Http:// the original CSDN blogger mchdba allowed, declined reproduced.

3, delete the original micro channel configuration paragraph, the introduction of new weixin.conf

Delete the old micro channel paragraph, in the VIM inside

:Three hundred and twelve,Three hundred and sixty-threeD
# said from the 312nd row to the 363rd row record all deleted. As shown below:
Three hundred and thirty 
Three hundred and thirty-oneHttp: proxy_pass//OCC_MAP_Web;
Three hundred and thirty-two            IncludeProxy.conf;
:Three hundred and twelve,Three hundred and sixty-threeD

Enter the key to perform, you will be prompted to delete the success, as shown below:

Three hundred and thirty-oneLocation ^ */parkingWeb/.${
Three hundred and thirty-two            IncludeDeny.conf;
LessFifty-twoThat's ok

After the original to add on the import weixin.conf configuration

    Config #weixin

4, restart nginx, so that the new configuration to take effect

[nginx@nginx_serviceNext week$Nginx reload service
Nginx reload
[nginx@nginx_serviceNext week$

5, with some VIM quick command

VIMultiple line deletion and replication in
One method:
Single line deletion,:One(to be removed) d
Multiple line deletion,:One,TenD
Method two:
Cursor line, DD
Where the cursor is located belowNThat's okNdd
Cursor to the firstSixThat's ok
Cursor to the firstNineThat's ok
Input: P
This method is suitable for copying a small number of lines of text.SixLine (including) the followingTwoLine data, put theNineBelow the line.
Command line mode input
Copy the firstSixLine toNineContent between rows toTwelveLine back.
Sometimes you don't want to look at how many lines or copy a large number of rows, you can use tags to replace
Move the cursor to the start line, enter the MA
Move the cursor to the end of the line, enter the MB
Move cursor to paste line, enter MC
Then:'a, 'BCoCO to change the m'c into a cut
To delete multiple lines, you can use:5, 9 de

VIM common commands
Common commands

1) cursor commands
K, J, h, l--- from top to bottom, left and right cursor movement commands, although you can use the keyboard to the right of the four cursor keys in Linux, but remember that the four order and very useful, is also the position of the right hand is placed on the keyboard part
----n nG is the number of rows, the command immediately to the specified row to the cursor.
Number of rows and columns in the position of the Ctrl+G----- cursor
B------, w allows the cursor to skip a word forward or backward.
2) edit command
I, a, R - in the cursor before, after the above insert character (i=insert, a=append, r=replace)
Dw------, CW change (replacement) / remove the cursor at the location of the command (c=change, d=delete)
X, d$, DD, delete a character, the cursor position to the end of the line all the characters, and the whole line command
3) search command
String-----, /string to find the corresponding string from the cursor at the back / forward.
4) copy copy
P, YY -- copy one line to the clipboard / take out the contents of the clipboard

Common problems and application skills
1) in a new file to read the contents of the /etc/passwd, remove the user name section
File VI
: /etc/passwd r in the open file file where the cursor is read into the /etc/passwd
%s/:.*//g /etc/passwd: delete the back from the beginning until the end of the line name of all parts of colon
3R /etc/passwd: This is in the specified line number back to read the file content
All blank lines and to # comment lines beginning another way to delete the file
Squid.conf.default grep -v #cat "^$'-v grep'^#' 

Two) when you open a file editing after the user login to the file write right, cannot save
File VI
: W/tmp/OneUnable to save, do not want to give up all the changes made, the first temporary storage to /tmp/One 
:Twenty,Fifty-nine/tmp/ wOneOr just put a thirdTwentyreachFifty-nineThe line between the contents of disk file /tmp/One
ThreeUse)VIEdit a file, but need to delete the contents of a large segment
File VI
Ctrl+GPress ctrl+ to move the cursor to the line that needs to be deleted.GTo display line numbers, according to the endCtrl+G.
:Twenty-three,One thousand and forty-fiveD assumes that the two line isTwenty-threeandOne thousand and forty-five, then the contents of the several all deleted

Can also be used in the start and end of the two row with the MB, Ma command:'a, 'BDDelete.
Four) throughout the document or a few lines at the beginning or end of a line with some string
File VI
:Three,$s/ ^String /some /Insert the some string file at the beginning of the first to the last line of the former
:%s/$/Some string/g in the entire file each at the end of the line to add some string

%s/string1/string2/gReplace string1 in the entire file into string2
:Three,SevenS/string1/string2/ only replace files in the third to seven rows in the string2 into string1

Note:S for substitute,% of all lines, G said global

FiveWhile editing two files, copy and paste the text in two files
File1 File2 VI
YY at the same time open the two files in the fileOneWhere the cursor is located
: nSwitch to fileTwo(n=Next)
P in fileTwoPaste the copy of the line where the cursor is located.
: NSwitch back to fileOne
SixReplace the path in the file

:%s#/usr/bin#/bin#g the file in all the path /usr/bin replaced by /bin
Or use
%s//usr/bin//bin/gstay'Before using the symbol pointed out'Is really a single character'
SevenVI multi line comment
If you want to give a multi line program notes, a stupid way is to insert#, then use J to jump to the next line. Repeat the last command command. If you want to comment a few hundred lines, this method is probably too stupid. A clever way to be:
:+.Four hundred and ninety-nineS/^/#/g
If you need the full text insert the following commands available
step on
Guess you're looking for
View comments
* the above user comments only represent their personal views, does not represent the views or position of the CSDN website
    personal data
    • Visit1000003 times
    • Integral:Sixteen thousand and forty-nine
    • Grade
    • Rank:319th name
    • Original438
    • Reproduced:3
    • Translation:2
    • Comments:523
    My lessons
    Blog column
    Technology URL link
    Classification of articles