Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ nginx.conf Optimization     - Setting up Linux machine through a proxy firewall (Linux)

- Java thread lifecycle (Programming)

- Linux Regular expressions grep and egrep (Linux)

- Paint with Vim (Linux)

- Network Security Basics Linux command (Linux)

- Create a DLL using MinGW and Attention (Programming)

- MySQL to NoSQL avatar (Database)

- Grading defense against Linux server attacks (Linux)

- The Linux firewall is configured to use proxy (Linux)

- RM Environment Database RMAN Backup Strategy Formulation (Database)

- Linux cut Command Study Notes (Linux)

- Linux Network Analysis Tcpdump Command Guide (Linux)

- Bootable ISO image using GRUB (Linux)

- MySQL loose index scan (Database)

- MongoDB3.0.6 wiredtiger MMAPv1 (Database)

- Hadoop virtualization performance comparison and tuning experience (Server)

- Oracle Database Performance Optimization of memory disk (Database)

- command-line tool for send e-mail (Linux)

- Linux system monitoring tool set cpu (Linux)

- Docker Basic Concepts (Linux)

  nginx.conf Optimization
  Add Date : 2018-11-21      
  Problem, nginx.conf document is too long, too large, inconvenient to maintain, so I wanted to split up, so good reading Ye Hao maintenance.

1, inside the nginx configuration on weixin all stripped out
Below, this is nginx.conf profile micro-channel configuration records, the future will be more and more.

 location ~ * ^ / weixin_g1. * $ {
          include deny.conf;

          proxy_pass http: // weixin_web_9600;
          include proxy.conf;

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

          include gzip.conf;

      location ~ * ^ / weixin_g2. * $ {
          include deny.conf;

          proxy_pass http: // weixin_web_9600;
          include proxy.conf;

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

          include gzip.conf;

      location ~ * ^ / weixin_g3. * $ {
          include deny.conf;

          proxy_pass http: // weixin_web_9600;
          include proxy.conf;

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

          include gzip.conf;

      location ~ * ^ / weixin_g4. * $ {
          include deny.conf;

          proxy_pass http: // weixin_web_9600;
          include proxy.conf;

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

          include gzip.conf;

2, regarding weixin regenerate a configuration file weixin.conf
vim nginx.conf
Then enter: edit line, enter 312,363 weixin.conf, then Enter, it will generate a new file, as follows:

[Root @ nginx_service ~] # vim /tmp/nginx.conf

  2 #user nginx nginx;
  3 worker_processes 24;
  5 #error_log logs / error.log;
 36 server 10.xx.1.211: 8000 max_fails = 5 fail_timeout = 30s;
 37 server 10.xx.1.212: 6100 max_fails = 5 fail_timeout = 30s;
 38 server 10.xx.1.215: 7100 max_fails = 5 fail_timeout = 30s;
 39 server 10.xx.1.216: 7000 max_fails = 5 fail_timeout = 30s;
: 312,363 w 1.conf Ding Dingding Ding Dingding Ding Dingding Ding Dingding Ding Dingding Ding Dingding top

3, delete the original micro-channel configuration paragraph, introducing new weixin.conf
Delete the old micro channel passages inside the vim

: 312,363d
# Means to delete all the rows from 312 to 363 rows away. As follows:
331 proxy_pass http: // OCC_MAP_Web;
332 include proxy.conf;
: 312,363d 1
Enter to execute, it prompts deleted successfully, as follows:

331 location ~ * ^ / parkingWeb /.*$ {
332 include deny.conf;
Less line 52 1
After you import the configuration on weixin.conf added after the original

    #weixin config
    include weixin.conf; 1
4, restart nginx, make new configurations take effect
[Nginx @ nginx_service ~] $ service nginx reload
reload nginx
[Nginx @ nginx_service ~] $

Top 5, with some of the vim shortcut command
VI The multi-row delete and copy
Method One:
To delete a single line,: 1 (to be deleted rows) d
Multi-row delete,: 1,10d
Act II:
Cursor line, dd
Line where the cursor below the N line, Ndd
method 1:
Cursor on line 6,
Input: 2yy
Cursor on line 9,
Input: p
This method is suitable for copying a small line of text, the copy line 6 (including) the following two lines of data into the line 9 below.
Method 2:
Enter the command-line mode
6,9 co 12
Line 6 to copy content between the 9th row back to the 12th line.
Method 3:
Sometimes you do not want to see how many rows strenuous or copy a large number of rows, you can use labels to substitute
Move the cursor to the starting line, enter ma
Move the cursor to the end of the line, enter mb
Move the cursor to paste line, enter mc
Then: 'a,' b co 'c into the co m on the shearing
To delete multiple rows, you can use: 5, 9 de

VIM common commands
Common Commands

1) Cursor command
k, j, h, l --- up and down cursor movement commands, although you can use the four cursor keys to the right of the keyboard in Linux, but keep in mind these four commands also very useful, that is, his right hand placed on the keyboard location part
nG ---- n is the number of rows, the command to make the cursor jump to the specified line immediately.
Ctrl + G ----- number of rows in the cursor position and the number of columns report
w, b ------ the cursor to skip forward or backward a word
2) Edit command
i, a, r ------- cursor in front, rear, top insert character command (i = insert, a = append, r = replace)
cw, dw ------ change (replacement) / Delete at the word under the cursor command (c = change, d = delete)
x, d $, dd ----- delete a character, place the cursor to the end of the line all the characters, and the entire line of command
3) Find command
/ String,? String ----- from the cursor backward / forward to find the appropriate command string
4) a copy of the copy command
yy, p ----- copied to the clipboard line / remove the contents of the Clipboard command

Frequently asked questions and application skills
1) read / etc / passwd contents in a new file, remove the user name part
vi file
: R / etc / passwd file in the open file at the cursor in read / etc / passwd
:% S /:.*// colon from the beginning until the end of the line all parts of the user name behind delete g / etc / passwd in
: 3r / etc / passwd This is the number specified in the back row to read the file contents
Another way to delete all files in the blank lines and comment lines that begin with #
#cat squid.conf.default | grep -v '^ $' | grep -v '^ #'

2) open a document to edit it after the user logged in to the file does not have write permission, you can not save
vi file
: W / tmp / 1 since it can not save, do not want to abandon all changes made, the first temporary memory to / tmp / 1
: 20,59w / tmp / 1 or merely content between the first 20-59 rows save to a file / tmp / 1
3) use VI to edit a file, but you need to remove large chunks of content
vi file
Ctrl + G to move the cursor at the need to remove rows of press ctrl + G to display line numbers, and then at the end press Ctrl + G.
: 23,1045d assume twice the line number 23 and 1045, the contents of several of these all-delete

You can also start and end with two lines ma, mb command labeled with: 'a,' bd deleted.
4) line beginning or end add some string in the whole document or a few lines
vi file
: 3, $ s / ^ / some string / file in the first line to the last line first before inserting some string
:% S / $ / some string / g in the entire file each end of the line to add some string

:% S / string1 / string2 / g replace the entire file into string1 string2
: 3,7s / string1 / string2 / Replace file only the third to seven rows into string1 string2

Note: s to substitute,% means that all rows, g represents global

5) simultaneously edit two files, copy text clip in two files
vi file1 file2
yy Open both files, copy the line in the file at the cursor 1
: N switch to File 2 (n = next)
p in the document at the cursor 2 paste the copied line
: N switch back to the file 1
6) Replace the file path

:% S # / usr / bin # / bin # g all the documents in the path / usr / bin into / bin
Or use
:% S // usr / bin // bin / g in the '/' symbol noted before '/' is really a single character '/'
7) multi-line comments with vi
If you give the program as a multi-line comment, it is to insert a Benbanfa #, then skip to the next row with j. Command, repeat the command. If you want to comment a few hundred lines, such an approach is probably stupid. A smart approach is:
:., + 499 s / ^ / # / g
For the full text of the line is inserted using the following command
:% S / ^ / # / g
- CentOS 6.x systems installation + NIC driver installation (Realtek PCIe GBE Family Controller for Linux) (Linux)
- Source MongoDB 3.2.1 installed on CentOS6.5 (Database)
- DataGuard add temporary data files bug (Database)
- Linux learning portal: CentOS 6.4 system kernel upgrade (Linux)
- Redis-2.8.17 installation and configuration process some errors (Linux)
- Linux how to handle file names that contain spaces and special characters (Linux)
- Fedora 22 users to install the VLC media player (Linux)
- Linux at command (Linux)
- Using IntelliJ IDEA Import Spark Spark latest source code and compile the source code (Linux)
- Customize the 404 error page Nginx (Server)
- Print Linux system error codes (Linux)
- Linux resource restriction level summary (Linux)
- Getting Started with Linux system to learn: how to install USB webcams come in raspberry (Linux)
- Four IDS intrusion detection tool under Linux environment (Linux)
- Installation JDK1.7 under Ubuntu14.04 64-bit (Linux)
- Fedora 21 setting boot script (Linux)
- Windows 8.1 and Ubuntu 14.04 dual system uninstall Ubuntu Tutorial (Linux)
- CentOS7 install MySQL5.6.22 (Linux)
- ThinkPad X201i installation notes Debian 7.5 (Linux)
- OpenDaylight Helium version installed (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.