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

  • What are the methods to force nginx to use https access?
    What are the methods to force nginx to use https access?
    nginx's rewrite method idea This should be the easiest method for everyone to think of. Rewrite all http requests to https through rewrite to configure server{listen111:80;server_nametestcom;rewrite^(*)$https://$host $1permanent;} After building this virtual host, you can rewrite all requests from http://test.com to https://test.com and get nginx’s 497 status code errorcode497497-normalrequestwassenttohtt
    Nginx 2546 2023-05-15 23:40:11
  • How to use nginx to cache static files on the server
    How to use nginx to cache static files on the server
    1. Advantages of nginx caching As shown in the figure, nginx caching can, to a certain extent, reduce the pressure on the source server in processing requests. Because many of the static files (such as css, js, pictures) are not updated frequently. nginx uses proxy_cache to cache user requests to a local directory. The next same request can directly call the cache file, without having to request the server. After all, the processing of IO-intensive services is nginx's strength. 2. How to set up the first chestnut: http{proxy_connect_timeout10;proxy_read_timeout180;proxy_send_timeout5
    Nginx 1839 2023-05-15 23:37:04
  • How to configure Nginx rush purchase current limit
    How to configure Nginx rush purchase current limit
    The code is as follows: limit_req_zone$server_namezone=sname:10mrate=1r/s;#Limit the server to only one successful access per second#limit_req_zone$binary_remote_addrzone=one:3mrate=1r/s;#Limit ip, only one access per second# limit_req_zone$binary_remote_addr$urizone=two:3mrate=1r/s;#Limit ip and path without parameters,#limit_req_zone$binary_remote_addr$re
    Nginx 1377 2023-05-15 22:58:10
  • How to configure Nginx virtual host
    How to configure Nginx virtual host
    1. Nginx virtual host configuration Virtual host: Normally, in order to make each server available to more users, a server can be divided into many virtual sub-servers, and each sub-server is independent of each other. These servers are separated based on virtualization technology, so that one server can be virtualized into many sub-servers. We call the sub-server a virtual host. After we set up the Nginx server, there is only one Nginx server at this time. If we configure the virtual host on this server, we can divide one Nginx server into multiple independent sub-servers. There are two main steps to configure a virtual host in Nginx: 1. Create a virtual host IP through ifconf
    Nginx 2835 2023-05-15 22:46:04
  • How to configure Nginx log format
    How to configure Nginx log format
    A small reservation program is launched and configured to access the entrance through Nginx. The default log does not have request time, so it needs to be configured to record the access response time of each request for reference and optimized use. 1. Default Log format The default log format is as follows (the default is commented out, and the system will automatically use it): #log_formatmain'$remote_addr-$remote_user[$time_local]"$request"'#'$status$body_bytes_sent"$http
    Nginx 2502 2023-05-15 22:43:12
  • How to deploy Django through Nginx based on ubuntu
    How to deploy Django through Nginx based on ubuntu
    1. Install nginx. Nginx is a lightweight web server/reverse proxy server and email (imap/pop3) proxy server, and is released under a bsd-like protocol. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx's concurrency capabilities do perform better among web servers of the same type. nginx is also a very popular web server currently. We will also give a brief introduction here to use it to deploy django. nginx official website: Open the ubuntu console (ctrl+alt+t) and use the ubuntu warehouse to install. fnngj@ubuntu:~$sudoapt-getinstallngin
    Nginx 1604 2023-05-15 22:31:04
  • How to deploy nginx to access projects built by vue-cli
    How to deploy nginx to access projects built by vue-cli
    The specific method is as follows: 1. Create the backend server object upstreammixVueServer{serverbaidu.com;#This is your own server domain name} 2. Create the access port and reverse proxy rule server{listen8082;server_namelocalhost;location/{rootE:/mix_vue/dist;# Locate the directory of the project#indexindex.htmlindex.htm;try_files$uri$uri//index.html;#Configure according to the rules of the official website}location~\.php${proxy_p
    Nginx 912 2023-05-15 22:25:16
  • How to solve the error when nginx service starts after Linux restarts: nginx: [emerg] open()
    How to solve the error when nginx service starts after Linux restarts: nginx: [emerg] open()
    Problem: After Linux restarts, an error occurs when starting the nginx server. Solution: 1. Use the command cd/usr/local/nginx/conf to enter the specified directory 2. Use the command vinginx.conf to modify the configuration file and remove the # sign in the icon 3. Change it to pid /usr/local/nginx/logs/nginx.pid;
    Nginx 3018 2023-05-15 22:16:13
  • How to set up browser negotiation cache based on nginx
    How to set up browser negotiation cache based on nginx
    The difference between strong cache and negotiated cache. Strong cache: The browser directly accesses the browser cache without negotiating with the server. Negotiated cache: The browser will first confirm the validity of the resource with the server before deciding whether to retrieve the resource from the cache or re-obtain the resource. Negotiate How Caching Works: There is a business scenario like this: the back-end static resources will be updated from time to time, and because the browser uses strong caching by default, outdated resources will be fetched from the browser cache by default. Now we want the browser to confirm with the backend whether the resource has been updated every time it obtains the resource, so we need to set the browser to use negotiation cache. So how does the backend determine whether the resource has been updated? At this time, the etag and last-modified response headers will be used. every time
    Nginx 3177 2023-05-15 22:07:04
  • How to set up pseudo-static WeCenter in Nginx environment
    How to set up pseudo-static WeCenter in Nginx environment
    Place the WeCenter Q&A system into the aks directory under the site root directory, and configure the pseudo message requirement code as follows: rewrite^([^\.]*)/ask/static/(.*)$$1/ask/static/$2last; rewrite^([^\.]*)/ask/uploads/(.*)$$1/ask/uploads/$2last;rewrite^([^\.]*)/ask/(.*)$$1/ask /index.php?/$2last;rewrite^([^\.]*)/ask/topic/(.*)$$1/ask/cnurl.phpl
    Nginx 813 2023-05-15 21:52:04
  • How to deal with Nginx discarding http packet body
    How to deal with Nginx discarding http packet body
    nginx discards http package body processing example detailed explanation http framework discards http request package body and the previous article http framework receives package body are two methods provided by the http framework for each http module to call to decide what to do with the package body deal with. Whether to choose to discard or receive is determined by the module. For example, if the static resource module receives a get request from the browser and requests a file, it can directly return the content of the file to the browser. There is no need to receive the package body data, and the get request will not actually have a package body. Therefore, the static resource module will call the discard packet body function provided by the http framework to perform packet discard processing. Compared with the process of receiving the package body, the operation of discarding the package body is much simpler.
    Nginx 1422 2023-05-15 21:49:04
  • How to use nginx forward proxy to forward intranet domain names
    How to use nginx forward proxy to forward intranet domain names
    In the customer's intranet environment, ppoe dial-up is used to access the Internet. The provider is a secondary operator within the group. The network environment is relatively complex. The group's internal network and office network are interconnected using a static routing protocol. The general situation is as follows: It turns out that the customer accesses the production business. They are all accessed through IP addresses. As more and more production services are produced, customers now strongly require the use of domain names to access services. However, given the complexity of the intranet environment, it is difficult to deploy a domain name server, and it is also difficult to deploy access services. Later, I learned nginx and learned that nginx can implement forward proxy to forward domain names. Instructions: 1. Configure domain name resolution on Alibaba Cloud. For example, oa.xxxx.com, the resolution address is the intranet address 172.31.101.362, 172.
    Nginx 3906 2023-05-15 21:46:04
  • How to use Docker Compose to implement nginx load balancing
    How to use Docker Compose to implement nginx load balancing
    Use docker network management and container ip settings as basic knowledge to implement nginx load balancing. View all docker networks dockernetworkls/*networkidnamedriverscopeb832b168ca9abridgebridgelocal373be82d3a6acomposetest_defaultbridgelocala360425082c4hosthostlocal154f600f0e90nonenulllocal*///composetest_default is the previous article when introducing compose, do
    Nginx 1792 2023-05-15 21:37:12
  • How to use Nginx to limit access frequency, download rate and number of concurrent connections
    How to use Nginx to limit access frequency, download rate and number of concurrent connections
    1. Overview of modules and instructions used to limit access frequency, concurrent connections, and download speed ngx_http_limit_req_module: used to limit the number of requests per unit time, that is, rate limit, using the leaky bucket algorithm "leakybucket" ngx_http_limit_conn_module: used to limit connections at the same time Number, that is, concurrency limit limit_rate and limit_rate_after: Download speed setting leaky bucket algorithm (leakybucket) The algorithm idea is: water (request) is poured into the bucket from above, flows out from below the bucket (processed), and the water that is too late to flow out is stored in the bucket (buffer) , flows out at a fixed rate; when the bucket is full, the water
    Nginx 1800 2023-05-15 21:22:22
  • How to configure common functions after Nginx installation
    How to configure common functions after Nginx installation
    1. Separate the main configuration file from the virtual host. If there are many virtual hosts, it will be more convenient to separate them. They can also be divided according to functions and services. The following takes two virtual hosts as an example. Complete configuration file after removing blank lines and comments: [root@nginx-01conf]#egrep-v"#|^$"nginx.conf.bakworker_processes1;events{worker_connections1024;}http{includemime.types;default_typeapplication/octet- stream;send
    Nginx 1226 2023-05-15 21:19:11

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