Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to fully analyze the process of installing Nginx

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to fully analyze the process of installing Nginx, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

There are tips and tricks to install Nginx. If you have a good grasp of these, you will be able to make better use of the relevant Nginx server. Let's take a look at the introduction to the problems related to installing Nginx. Because the server apache can not resist the current concurrency. After adding the front-end squid configuration.

The problem is still unsolved. And the page program is mostly dynamic. Cannot use fastcgi to process. Therefore, I want to use Nginx as a reverse proxy apache. The whole configuration and installation process is very simple. In the case of high concurrency, some optimizations are made before installation. The current configuration can withstand more than 3000 concurrency. It doesn't seem very big, huh? Heh ~ ~ but enough ~ ~ only there are a few 499 questions.. I expect someone to discuss and solve the problem with me.

Install Nginx process

1 set up users and groups

/ usr/sbin/groupadd www

/ usr/sbin/useradd-g www www

2 install pcre to make it convenient to install Nginx to support rewrite for future needs

Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.tar.gz

Tar zxvf pcre-7.8.tar.gz

Cd pcre-7.8/

. / configure

Make & & make install

3 install Nginx

Wget http://sysoev.ru/ nginx / nginx-0.7.58.tar.gz

Tar zxvf nginx-0.7.58.tar.gz

Cd nginx-0.7.58/

. / configure-- user=www-- group=www-- prefix=/usr/local/

Webserver/nginx-with-http_stub_status_module

-with-http_ssl_module-with-cc-opt='-O2'

-- with-cpu-opt=opteron

Make & & make install

Note the above-- with-cc-opt='-O2'-- with-cpu-opt=opteron, which is compiler optimization, and currently the most commonly used is-02 instead of 3. 0. For the corresponding CPU model, please see: http://wiki.gentoo.tw/index.php/HOWTO_CFLAG

Configuration and optimization profile

Nginx.conf profile:

User www www

Worker_processes 4

# [debug | info | notice | warn | error | crit]

Error_log / usr/local/webserver/nginx/logs/nginx_error.log

Crit

Pid / usr/local/webserver/nginx/nginx.pid

# Specifies the value for maximum file descriptors that

Can be opened by this process.

Worker_rlimit_nofile 51200

Events

{

Use epoll

Worker_connections 51200

}

Http

{

Include mime.types

Default_type application/octet-stream

Source_charset GB2312

Server_names_hash_bucket_size 256

Client_header_buffer_size 256k

Large_client_header_buffers 4 256k

# size limits

Client_max_body_size 50m

Client_body_buffer_size 256k

Client_header_timeout 3m

Client_body_timeout 3m

Send_timeout 3m

# parameters have been adjusted. The purpose is to solve some 502 499 errors in the agent process.

Sendfile on

Tcp_nopush on

The parameter keepalive_timeout 120; # was enlarged to resolve the 502 error when acting as an agent.

Tcp_nodelay on

Include vhosts/upstream.conf

Include vhosts/bbs.linuxtone.conf

}

The above is how to fully analyze the process of installing Nginx. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report