Install and configure Nginx server under linux

WBOY
Release: 2016-07-29 08:55:48
Original
1078 people have browsed it

1. Install Nginx using yum (2) , Install the G++ compiler yum -y install gcc-c++

(3), Install the PCRE library yum -y install pcre pcre-devel

Install the zlib library yum -y install zlib zlib-devel

Install the OpenSSL development library yum -y install openssl openssl-devel

3. Nginx directory structure

Use the root user to install online. Nginx is saved in the following directories.

/usr/sbin/nginx -------------------------- nginx under sbin is an executable file, which can be used to start nginx

/etc/nginx -------------------------- This is the nginx program installation directory

/usr/share/nginx -------------------------- The shared files are placed here, which contain the test homepage

/usr/share/man/ man8/nginx.8.gz

/usr/share/man/man3/nginx.3pm.gz

4. Linux kernel parameter optimization First of all, you need to modify

/etc/sysctl. conf

file to modify kernel parameters (the first time you open it is an empty file). For example, the most commonly used configuration:

fs.file-max = 10000 net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_fin_timeout = 30

net.ipv4.tcp_ max_tw_buckets = 5000

net.ipv4.ip_local_port_range = 1024 61000 net.ipv4.tcp_rmem = 4096 32768 262142 net.ipv4.tcp_wmem = 4096 32768 262142

net.core.netdev_max_ backlog = 8096

net.core.rmem_default = 262144 net.core. wmem_default = 262144 net.core.rmem_max = 2097152 net.core.wmem_max = 2097152 net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_max_syn_backlog = 1024




Then execute
sysctl -p
to make the above The settings take effect.



Related instructions:





The above introduces the installation and configuration of Nginx server under Linux, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials. Install and configure Nginx server under linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template