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

  • How to enable SSL configuration in Nginx server
    How to enable SSL configuration in Nginx server
    To generate a certificate, you can generate a simple certificate by following the following steps: First, enter the directory where you want to create the certificate and private key, for example: $cd/usr/local/nginx/conf to create the server private key. The command will ask you to enter a password: $opensslgenrsa-des3-outserver.key1024 Create certificate (csr) for signing request: $opensslreq-new-keyserver.key-outserver.csr Remove necessary password when loading nginx with ssl support and use the above private key: $cpserver.keyserver .key.org$opensslrsa
    Nginx 1369 2023-06-03 15:12:09
  • Docker runs nginx using daemon off instance analysis
    Docker runs nginx using daemon off instance analysis
    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 1554 2023-06-03 14:04:12
  • How to install and configure nginx under Centos7
    How to install and configure nginx under Centos7
    Note: The basic directory path for software installation: /usr/local, so when downloading the software, switch to this directory and download and unzip it directly 1. Install the gccgcc-c++ dependency package yuminstall-ygccgcc-c++ 2. Download, compile and install the pcre library Switch to the usr/local directory and execute the command to download the installation package wget decompress the installation package tar-zxvfpcre-8.36.tar.gz compile and install cdpcre-8.36./configuremake&&makeinstall3. Download compile and install the ssl library download the installation package wget decompress the compressed package tar-zxvfopenssl
    Nginx 1417 2023-06-03 13:36:14
  • How to configure PATHINFO in Nginx to hide thinkphp index.php
    How to configure PATHINFO in Nginx to hide thinkphp index.php
    nginx configuration pathinfo hides index.php Put this code in the nginx configuration file server{listen80;default_typetext/plain;root/var/www/html;indexindex.phpindex.htmindex.html;#hide index.phplocation/{if(!- e$request_filename){#First-level directory#rewrite^/(.*)$/index.php/$1last;#Second-level directory rewrite^/myapp/(.*)$/myapp/
    Nginx 881 2023-06-03 13:18:14
  • How to configure Nginx host domain name
    How to configure Nginx host domain name
    1. Configure multiple ports to access different files with the same domain name, different ports, and different files #Two different folders, storing different files respectively [root@nginx~]#mkdir/www/work_01-p[root@nginx~]#mkdir /www/work_02[root@nginx~]#vim/www/work_01/index.htmlthisiswork_01![root@nginx~]#vim/www/work_02/index.htmlthisiswork_02!#Edit the server module and point the port 80 site to a folder and copy it
    Nginx 1930 2023-06-03 13:13:04
  • How to optimize Nginx and Node.js
    How to optimize Nginx and Node.js
    If network optimization does not first understand the underlying transmission mechanisms of nginx and node.js and carry out targeted optimization, no matter how detailed the optimization of the two is, it may be in vain. Generally, nginx connects the client and upstream applications through tcpsocket. Our system has many thresholds and restrictions for tcp, which are set through kernel parameters. The default values ​​of these parameters are often set for general purposes and cannot meet the high traffic and short life requirements of web servers. Here are some parameters that are candidates for tuning tcp. To make them effective, you can place them in the /etc/sysctl.conf file, or put them in a new configuration file, such as /etc/sysctl.
    Nginx 877 2023-06-03 12:41:53
  • How to configure caching of static files in nginx
    How to configure caching of static files in nginx
    1. Preparation matters I think you need a normal working nginx software: install nginx, php7 and mysql5.7 (lemp) on ubuntu16.04lts. 2 To configure nginx, you can refer to the expires command manual to set the http header expiration time. This mark can be placed in statement blocks such as http{}, server{}, location{}, or conditional statements in the location{} statement block. Generally, you will use the expires directive in the location statement block to control your static files, like the following: location~*\.(jpg|jpeg|png|gif|ico|css|js
    Nginx 1824 2023-06-03 12:31:44
  • How to use nginx simulation for blue-green deployment
    How to use nginx simulation for blue-green deployment
    Blue-green deployment The focus of blue-green deployment lies in the following characteristics: 1. The blue version and the green version exist at the same time. 2. The actual running environment is blue or green, and can only be one of them. Analysis of advantages and disadvantages through switch control: The advantages are: It's speed and rollback. And the shortcomings are also obvious. Quick rollback is possible because two sets of environments exist at the same time, so the complexity and required resources will increase because there are two sets of environments. In addition, although the speed has been improved, in the implementation process, the switch control, no matter how fast the switching speed, is still unable to achieve completely seamless switching without combining other technologies. Simulate blue-green deployment Next, we use nginx's upstream to simply simulate the blue-green deployment scenario. The specific scenarios are as follows, currently active
    Nginx 855 2023-06-03 12:31:03
  • How nginx rewrite implements URL jump
    How nginx rewrite implements URL jump
    URL jump The URL jump mentioned here is to jump to another URL when the user accesses one URL. A common application scenario is to let multiple domain names jump to the same URL (for example, let the old domain name jump to a new domain name), jump static file requests to CDN, etc. Jump to different sites according to the user's device (PC version) , wap version), etc. URL jump can be achieved by setting the window.location on the page with js or by setting the header with php. Of course, it can also be implemented using the rewrite function of nginx. The nginxrewrite module rewrite is the static rewrite module of nginx. The basic usage is rewritepattenre.
    Nginx 1179 2023-06-03 11:55:28
  • How to configure nginx log scheduled backup and deletion
    How to configure nginx log scheduled backup and deletion
    Once the nginx logging function is turned on, nginx will generate log files of a certain size every day. If the system runs stably and there are no problems, then the logs will basically not be viewed. However, if these logs are not cleared in time, they will accumulate day by day and occupy a terrible amount of disk space on the server. In order to solve this problem, use a shell script to regularly back up and delete nginx log files, and only keep them for a period of time. Figure 1: #!/bin/bash#auth:lzq#desc: Back up the current log by date and regenerate the next day’s log file #date:2016-09-18date=`date+%y%m%d`nginx_pid =`cat/var
    Nginx 1429 2023-06-03 10:59:17
  • How does Nginx realize 404 automatically jump to the home page?
    How does Nginx realize 404 automatically jump to the home page?
    404 automatically jumps to the homepage server{location/{error_page404=@ops-coffee;}location@ops-coffee{rewrite.*/permanent;}}. The 404 page on the website is not particularly friendly. We can use the configuration above to prevent 404 from appearing. Then it will automatically jump to the home page.
    Nginx 1171 2023-06-03 10:16:32
  • What should I do if nginx deploys vue and cannot find the js css file?
    What should I do if nginx deploys vue and cannot find the js css file?
    Many times after npmrunbuild, the relative directory of the js file and css file automatically inserted by webpack in the index.html file is always wrong. After publishing it to the server, nginx cannot find the file. vue-cli@3 In vue-cli@3 you need to add a baseurl for all files that your webpack inserts into index.html. You need to create a new vue.config.js in the root directory of the project and add the following content:. ..module.exports={baseurl:isprod?'/basexxx/':&#3
    Nginx 1367 2023-06-03 10:05:25
  • Nginx basic introduction to gzip configuration method
    Nginx basic introduction to gzip configuration method
    Preface gzip (gnu-zip) is a compression technology. After gzip compression, the page size can be reduced to 30% or even smaller than the original size. In this way, users will browse the page much faster. The gzip compressed page needs to be supported by both the browser and the server. It is actually server-side compression. After being transmitted to the browser, the browser decompresses and parses it. We don’t need to worry about the browser, because most current browsers support parsing gzip pages. Whether it is front-end or back-end, nginx is often used when deploying projects, and small projects often use a reverse proxy or something. Today I will be simple and direct and talk about one of the points - gzip. If there are any errors, please correct me. Generally used on the server side is u
    Nginx 4146 2023-06-03 09:52:43
  • How to install and configure Nginx on Linux server
    How to install and configure Nginx on Linux server
    nginx installation 1. Install the compilation tools and library files yum-yinstallmakezlibzlib-develgcc-c++libtoolopensslopenssl-devel 2. First install pcrepcre to enable nginx to support the rewrite function. 1. Download the pcre installation package, download address: [root@bogonsrc]#wgethttp://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz2. Unzip the installation package: [root@bogonsrc
    Nginx 1445 2023-06-03 09:40:10
  • Example analysis of adding account and password verification to nginx
    Example analysis of adding account and password verification to nginx
    nginx adds account and password authentication server{location/{auth_basic"pleaseinputuser&passwd";auth_basic_user_filekey/auth.key;}}. There are many services accessed through nginx, but they do not provide account authentication functions. You can use the authbase account password authentication provided by nginx. To implement, you can use the following script to generate the account password #catpwd.pl#!/usr/bin/perlusestrict;my$pw=$ARGV[0];printcrypt
    Nginx 694 2023-06-03 09:28:22

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!