nginx學習筆記 一

2021-08-05 19:57:14 字數 3289 閱讀 5168

1.與nginx同類的軟體

iis2.nginx的依賴庫

gcc 

gcc-c

++正則庫

pcre

pcre-devel

zlib zlib-devel

openssl openssl-devel

預設的安裝目錄

/usr/local/nginx
修改核心引數

/etc/sysctl.conf

sysctl -p 使修改後生效

fs.file-max = 999999

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

.rmem_max = 2097152

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_max_syn_backlog = 1024

nginx的命令列控制

nginx -g xx 

nginx -g -s stop

➜ init-container git:(master) ✗ nginx -h

nginx version: nginx/1.12

.0usage: nginx [-?hvvttq] [-s signal] [-c filename] [-p prefix] [-g directives]

options:

-?,-h : this help

-v : show version and

exit

-v : show version and configure options then

exit

-t : test configuration

andexit

-t : test configuration, dump it and

exit

-q : suppress non-error messages during configuration testing

-s signal : send signal

to a master process: stop, quit, reopen, reload

-p prefix : set prefix path (default: /usr/local/cellar/nginx/1.12

.0_1/)

-c filename : set configuration

file (default: /usr/local/etc/nginx/nginx.conf)

-g directives : set global directives out

ofconfiguration

file

nginx配置預設檔案

/usr/local/nginx
配置的通用語法

nginx學習筆記(一)

1.nginx的基本作用 2.選擇nginx的理由 a 支援 5w 的併發。b 記憶體消耗少。c 成本低。d 節省頻寬 e 配置簡單,支援重寫 rewrite 內建健康檢查,熱部署,穩定性高。3.nginx中location模組的詳細引數介紹 nginx的location可以有以下幾個匹配 1.嚴格...

Nginx學習筆記一

1.做靜態檔案的對映 修改config目錄下的nginx.conf檔案,其中serve節點內容改為如下 server error page 500 502 503 504 50x.html location 50x.html 這樣我們訪問 localhost 8080 test.png 實際訪問的就...

nginx學習筆記一

nginx是一款輕量級的web 伺服器 反向 伺服器及電子郵件 imap pop3 伺服器,在bsd like 協議下發行。其特點是占有記憶體少,併發能力強,事實上nginx的併發能力確實在同型別的網頁伺服器中表現較好。nginx可實現的功能 反向 負載均衡 動靜分離 一 nginx在centos6...