current location:Home > Technical Articles > Operation and Maintenance > Nginx

  • How to use nginx for load balancing
    How to use nginx for load balancing
    Four-layer load balancing vs seven-layer load balancing. It is often said that seven-layer load balancing or four-layer load balancing is actually decided based on the name of the layer of the iso osi network model. nginx uses the http protocol to load the application layer. Balanced operation, so it is called seven-layer load balancing. For example, lvs that performs load balancing operations on the tcp layer is called layer 4 load balancing. Generally speaking, there are the following load balancing classifications: Common software support Common load balancing algorithms Common load balancing algorithms include the following: Load balancing demonstration example: ordinary polling Next, use nginx to demonstrate how to perform ordinary polling. : Prepare in advance to start two services on the two ports 7001/7002 for display.
    Nginx 1962 2023-06-03 08:19:12
  • How to configure nginx to ensure that the frps server and web share port 80
    How to configure nginx to ensure that the frps server and web share port 80
    First of all, you will have a doubt, what is frp? Simply put, frp is an intranet penetration tool. After configuring the client, you can access the intranet through the server. Now my server has used nginx as the website, and there is only one port 80. So what should I do if the FRP server also wants to use port 80? After querying, this can be achieved by using nginx's reverse proxy. To add: frps is the server, frpc is the client. Step 1: Modify the nginx.conf configuration file in the server and add the following parameters to http{} in nginx.conf, server{listen80
    Nginx 1170 2023-06-03 08:19:08
  • Analysis of Nginx common configuration examples
    Analysis of Nginx common configuration examples
    Block IP You can block the specified IP through deny http{#....#Block IPdeny192.168.4.3;deny31.42.145.0/24;deny51.12.35.0/24;}Only to open the intranet, you need to prohibit 192.168.1.1 from being opened first Other intranet segments, and then prohibit all other IPlocation/{#blockoneworkstationdeny192.168.1.1;#allowanyonein192.168.1.0/24allow192.168.1.0/24;#droprestoftheworlddenyall;} negative
    Nginx 1337 2023-06-02 23:14:50
  • How to install and configure Lua support for Nginx
    How to install and configure Lua support for Nginx
    Nginx installation and configuration Lua support By default, Nginx does not support Lua modules. You need to install the LuaJIT interpreter and recompile Nginx, or you can use the modules required by openrestry developed by Chinese people: LuaJIT, Ngx_devel and lua-nginx-module1. Environment preparation [root @nginx_lua~]#yuminstall-ygccgcc-c++makepcre-develzlib-developenssl-devel2. Download the latest luajit and ngx_devel_kit and lua-nginx-module decompression [r
    Nginx 2330 2023-06-02 22:01:10
  • How to configure Nginx multiple domain names under windows
    How to configure Nginx multiple domain names under windows
    1. The directory structure for installing nginx under windows is as follows: 2. Contents of conf/nginx.conf in the nginx-1.12.1 directory #usernobody;worker_processes1;events{worker_connections1024;}http{includemime.types;default_typeapplication/octet-stream;sendfileon ;keepalive_timeout65;server{listen80default_server;server_n
    Nginx 2019 2023-06-02 21:43:54
  • How to implement nginx reverse proxy in Centos7
    How to implement nginx reverse proxy in Centos7
    The reverse proxy server is set up on the server side to relieve the workload of the server by buffering frequently requested pages, forwarding client requests to the target server on the internal network; and returning the results obtained from the server to the Internet to request a connection. At this time, the proxy server and the target host appear as a server to the outside world. Currently, web websites use reverse proxies, which in addition to preventing vicious attacks from the external network on internal servers, caching to reduce server pressure and access security control. Experimental environment: 192.168.1.188nginx load balancer 192.168.1.189web01 server 192.168.1.190web02 server software preparation: cen
    Nginx 1134 2023-06-02 20:16:01
  • How to solve the problem of 499 and failover mechanism failure caused by improper nginx configuration
    How to solve the problem of 499 and failover mechanism failure caused by improper nginx configuration
    The meaning and possible reasons of 499. 499 is not actually the standard status code of the HTTP protocol, but a custom status code of nginx. I have not found a clear explanation of this status code in the official nginx documentation. Here is a blog post that feels more professional. Explanation on: HTTPerror499simplymeansthattheclientshutoffinthemiddleofprocessingtherequestthroughtheserver.The499errorcodeputsbetterlightthatsomethinghappenedwiththeclien
    Nginx 1688 2023-06-02 19:54:24
  • What is the reason why docker uses daemon off when running nginx?
    What is the reason why docker uses daemon off when running nginx?
    Question 1. Why does the docker container hang when it is running? By default, the docker container will use the first process inside the container, that is, the program with pid=1, as the basis for whether the docker container is running. If the docker container pid hangs, the docker container will exit directly. 2. When docker runs, use command as the internal command of the container. If you use nginx, then the nginx program will run in the background. At this time, nginx is not the program with pid 1, but the executed bash. This bash will hang after executing the nginx command. , so the container also exited. The same reason as yours. After pm2start, bash
    Nginx 3691 2023-06-02 19:32:13
  • How to configure the specified save file name for file download in nginx
    How to configure the specified save file name for file download in nginx
    Generally, after we upload the resource file, in order to avoid file name conflicts, we will change the file name to a meaningless period of characters. This character may be generated by md5, or a string generated by other methods. At this time, when downloading, the file name saved by default will be this meaningless file name (Figure 1). In fact, nginx supports renaming during downloading, making the file name more friendly. nginx is also easy to configure: just add the following lines: Copy the code The code is as follows: location~*.*\.(doc|txt|jar|zip|apk)(\?.*)?${if($request_uri ~*^.*\/(.*)\.(doc|txt|jar
    Nginx 1730 2023-06-02 16:04:06
  • How does Nginx configure a site with multiple domain names?
    How does Nginx configure a site with multiple domain names?
    A site is configured with multiple domain names server{listen80;server_nameops-coffee.cnb.ops-coffee.cn;}server_name followed by multiple domain names, separated by spaces.
    Nginx 1242 2023-06-02 15:34:13
  • How does nginx enable one server to access multiple websites?
    How does nginx enable one server to access multiple websites?
    On a server, there are usually two ways to distinguish between accessing different websites: 1. Through the listening port number 2. Through the domain name 1. Accessing different hosts through the port: nginx configuration file: /usr/local/nginx/conf /nginx.confcentos file default encoding format latin1 Command to view the encoding format: :setfileencoding#usernobody;worker_processes1;#error_loglogs/error.log;#error_loglogs/error.lognotice;#error_loglogs/error
    Nginx 2841 2023-06-02 14:16:06
  • How to configure Nginx current limiting
    How to configure Nginx current limiting
    For the empty bucket, we start with the simplest current limiting configuration: limit_req_zone$binary_remote_addrzone=ip_limit:10mrate=10r/s;server{location/login/{limit_reqzone=ip_limit;proxy_passhttp://login_upstream;}}$binary_remote_addr for client ip limit flow; zone=ip_limit: The name of the 10m current limit rule is ip_limit, which allows the use of 10mb of memory space to record the current limit status corresponding to the ip; rate=
    Nginx 2003 2023-06-02 13:10:06
  • What is the source code of nginx thread pool?
    What is the source code of nginx thread pool?
    1. Task node typedefvoid(*cb_fun)(void*);//Task structure typedefstructtask{void*argv;//Parameters of the task function (before the task execution ends, ensure that the parameter address is valid) cb_funhandler;//Task function ( The return value must be 0 and non-zero values ​​are used to add threads and destroy thread pools) structtask*next;//task chain pointer}zoey_task_t; handler is a function pointer, which is the actual task function, argv is the parameter of the function, and next points to Next task. 2.Task queue typedefstructt
    Nginx 1235 2023-06-01 22:20:29
  • Analysis of simple installation examples of Nginx under centos6.5
    Analysis of simple installation examples of Nginx under centos6.5
    1. Configure the yum source: Create the file: /etc/yum.repos.d/nginx.repotouch/etc/yum.repos.d/nginx.repo Edit the file, vi/etc/yum.repos.d/nginx.repo Write the following content: [nginx]name=nginxrepobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1 Save. The yum source configuration is completed. You can use the following command to check whether the yum source is configured correctly
    Nginx 1256 2023-06-01 21:07:22
  • How do websites set black/whitelist IP restrictions and country and city IP access restrictions through nginx?
    How do websites set black/whitelist IP restrictions and country and city IP access restrictions through nginx?
    1. Black/white list IP restricted access configuration nginx There are several ways to configure black and white lists. Here are only two commonly used methods. 1. The first method: allow, denydeny and allow instructions belong to ngx_http_access_module. nginx loads this module by default, so it can be used directly. This method is the simplest and most direct. The setting is similar to the firewall iptable. How to use: Add directly to the configuration file: #Whitelist settings, followed by allow is accessible IPlocation/{allow123.13.123.12;allow23.53.32.1/100;denyall;}#Blacklist settings,
    Nginx 3543 2023-06-01 17:27:30

Tool Recommendations

jQuery enterprise message form contact code

jQuery enterprise message form contact code is a simple and practical enterprise message form and contact us introduction page code.
form button
2024-02-29

HTML5 MP3 music box playback effects

HTML5 MP3 music box playback special effect is an mp3 music player based on HTML5 css3 to create cute music box emoticons and click the switch button.

HTML5 cool particle animation navigation menu special effects

HTML5 cool particle animation navigation menu special effect is a special effect that changes color when the navigation menu is hovered by the mouse.
Menu navigation
2024-02-29

jQuery visual form drag and drop editing code

jQuery visual form drag and drop editing code is a visual form based on jQuery and bootstrap framework.
form button
2024-02-29

Organic fruit and vegetable supplier web template Bootstrap5

An organic fruit and vegetable supplier web template-Bootstrap5
Bootstrap template
2023-02-03

Bootstrap3 multifunctional data information background management responsive web page template-Novus

Bootstrap3 multifunctional data information background management responsive web page template-Novus
backend template
2023-02-02

Real estate resource service platform web page template Bootstrap5

Real estate resource service platform web page template Bootstrap5
Bootstrap template
2023-02-02

Simple resume information web template Bootstrap4

Simple resume information web template Bootstrap4
Bootstrap template
2023-02-02

Cute summer elements vector material (EPS PNG)

This is a cute summer element vector material, including the sun, sun hat, coconut tree, bikini, airplane, watermelon, ice cream, ice cream, cold drink, swimming ring, flip-flops, pineapple, conch, shell, starfish, crab, Lemons, sunscreen, sunglasses, etc., the materials are provided in EPS and PNG formats, including JPG previews.
PNG material
2024-05-09

Four red 2023 graduation badges vector material (AI EPS PNG)

This is a red 2023 graduation badge vector material, four in total, available in AI, EPS and PNG formats, including JPG preview.
PNG material
2024-02-29

Singing bird and cart filled with flowers design spring banner vector material (AI EPS)

This is a spring banner vector material designed with singing birds and a cart full of flowers. It is available in AI and EPS formats, including JPG preview.
banner picture
2024-02-29

Golden graduation cap vector material (EPS PNG)

This is a golden graduation cap vector material, available in EPS and PNG formats, including JPG preview.
PNG material
2024-02-27

Home Decor Cleaning and Repair Service Company Website Template

Home Decoration Cleaning and Maintenance Service Company Website Template is a website template download suitable for promotional websites that provide home decoration, cleaning, maintenance and other service organizations. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-05-09

Fresh color personal resume guide page template

Fresh color matching personal job application resume guide page template is a personal job search resume work display guide page web template download suitable for fresh color matching style. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-29

Designer Creative Job Resume Web Template

Designer Creative Job Resume Web Template is a downloadable web template for personal job resume display suitable for various designer positions. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28

Modern engineering construction company website template

The modern engineering and construction company website template is a downloadable website template suitable for promotion of the engineering and construction service industry. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28