1.1 Introduction
Open source reverse proxy server, can be used as load balancing, HTTP cache or web server.
Supports HTTP, HTTPS, SMTP, POP3, IMAP and other protocols.
Support for multiple operating systems.
characteristic:
- Hot deployment: without interrupting service, direct upgrade version, modify the configuration file, replace the log file.
- High concurrent connections: supports more than 100K concurrent upper limit depends on the machine's memory.
- Low memory consumption: just do not consume memory
- Fast response: that is, fast response
- High reliability: that is very reliable
1.2 DockerHub mirroring
[root@localhost ~]# docker run -d -p 80:80 --name webserver_nginx nginx
Note whether the container before running the Apache occupied port 80, if not, then open the browser to access the welcome page to nginx
1.3 custom web page
Create an index.html file, as follows
Then use docker run mount the container to view the display, where the book there is a mistake, said earlier that the container volume mount host chapter to write the absolute path to the container, and is best not to directly mount the file to be wrong, the book is a direct mountable file, did not write the absolute path. P102 page
[root@localhost nginx]# docker run --name webserver_nginx_tz -p 80:80 -v /root/nginx:/usr/share/nginx/html:ro -d nginx
Results are as follows
1.4 Use custom Dockerfile
P102 page, when pumping a time to look at it
1.5 Parameter Optimization
Common Nginx server kernel optimization parameters are as follows
net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter =1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 net.ipv4.tcp_max_tw_buckets = 6000 #timewait的数量 net.ipv4.tcp_sack = 1 #有选择的应答 net.ipv4.tcp_window_scaling = 1 #设置tcp/ip会话滑动窗口是否可变,1可变,0不可变。开启使滑动窗口大小增加数个数量级,提高数据传输能力 net.ipv4.tcp_rmem = 4096873804194304 #tcp接收缓冲区 net.ipv4.tcp_wmem = 4096163844194304 #tcp发送缓冲区 net.core.wmem_default = 8388608#发送套接字缓冲区大小的缺省值(字节单位) net.core.rmem_default = 8388608 #接收套接字缓冲区大小的缺省值 net.core.rmem_max = 16777216 #接收套接字缓冲区大小的最大值 net.core.wmem_max = 16777216 #发送套接字缓冲区大小的最大值 net.core.netdev_max_backlog = 262144 #允许送到队列的数据包最大数目 net.core.somaxconn = 262144#web应用中listen函数的backlog(积压) net.ipv4.tcp_max_orphans = 3276800 #最多有多少个TCP套接字不被关联到任何一个用户的句柄上 net.ipv4.tcp_max_syn_backlog = 262144 #记录那些尚未收到客户端确认信息的连接请求最大值,表示SYN队列的长度,可以容纳更多等待连接的网络连接数 net.ipv4.tcp_timestamps = 0 #时间戳关闭 net.ipv4.tcp_synack_retries = 1 #这个设置决定了内核放弃连接之前发送SYN+ACK包的数量 net.ipv4.tcp_syn_retries = 1#内核放弃连接之前发送SYN包的数量 net.ipv4.tcp_tw_recycle = 1 #timewait快速回收 net.ipv4.tcp_tw_reuse = 1 #timewait 用于新的连接 net.ipv4.tcp_mem =1835008 2752512 3670016 #out of socket memory net.ipv4.tcp_fin_timeout = 15 # retention time FIN-WAIT-2 state, the end of an error even when the machine never off the default value is 60s net.ipv4.tcp_keepalive_time = 30#keepalived 发送消息的频度 net.ipv4.ip_local_port_range port range = 102 465 000 #
In:
https://www.cnblogs.com/DemonAngel/p/5511150.html
Write very detailed, praise