From 86542c068999f4be0ad3ff25659b67f6309fb752 Mon Sep 17 00:00:00 2001 From: xking Date: Fri, 21 Mar 2025 15:35:41 +0800 Subject: [PATCH] update --- debian 11 安装 编译nginx.md | 94 ++++++++++++++++----------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/debian 11 安装 编译nginx.md b/debian 11 安装 编译nginx.md index 30fae2d..71c0b73 100644 --- a/debian 11 安装 编译nginx.md +++ b/debian 11 安装 编译nginx.md @@ -4,7 +4,7 @@ ##### 安装编译环境 -``` +```bash #GCC apt install -y build-essential @@ -59,7 +59,7 @@ https://nginx.org/download/nginx-1.22.0.tar.gz -``` +```bash ./configure \ --prefix=/usr/local/nginx \ --user=www \ @@ -170,7 +170,7 @@ curl 127.0.0.1 加到 http 节点中 -``` +```nginx include mime.types; default_type application/octet-stream; @@ -261,7 +261,7 @@ curl 127.0.0.1 #### 附1: `systemctl 操作` -``` +```bash #重载配置文件 添加新的 或者修改都要重载。 systemctl daemon-reload @@ -334,7 +334,7 @@ curl 127.0.0.1 apt 卸载nginx -``` +```bash 查询 nginx 相关软件 dpkg --get-selections|grep nginx @@ -352,8 +352,7 @@ apt-get --purge remove nginx ###### nginx.conf ```nginx - -worker_processes auto; +worker_processes auto; worker_rlimit_nofile 51200; @@ -368,55 +367,54 @@ stream { events { - use epoll; - worker_connections 51200; - multi_accept on; - } + use epoll; + worker_connections 51200; + multi_accept on; +} http { - include mime.types; - default_type application/octet-stream; + include mime.types; + default_type application/octet-stream; - server_names_hash_bucket_size 512; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 50m; + server_names_hash_bucket_size 512; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 50m; - sendfile on; - tcp_nopush on; + sendfile on; + tcp_nopush on; - keepalive_timeout 60; + keepalive_timeout 60; - tcp_nodelay on; + tcp_nodelay on; - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 256k; - fastcgi_intercept_errors on; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 256k; + fastcgi_intercept_errors on; - gzip on; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_http_version 1.1; - gzip_comp_level 2; - gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; - gzip_vary on; - gzip_proxied expired no-cache no-store private auth; - gzip_disable "MSIE [1-6]\."; + gzip on; + gzip_min_length 1k; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_comp_level 2; + gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; + gzip_vary on; + gzip_proxied expired no-cache no-store private auth; + gzip_disable "MSIE [1-6]\."; - limit_conn_zone $binary_remote_addr zone=perip:10m; - limit_conn_zone $server_name zone=perserver:10m; + limit_conn_zone $binary_remote_addr zone=perip:10m; + limit_conn_zone $server_name zone=perserver:10m; - server_tokens off; - access_log off; + server_tokens off; + access_log off; - - include /etc/nginx/site-enable/*.conf; + include /etc/nginx/site-enable/*.conf; } ``` @@ -425,7 +423,7 @@ http { ###### web-site.conf -``` +```nginx server { listen 80; server_name frp.plugin.dr1997.com; @@ -450,7 +448,7 @@ server { ###### ssl -``` +```nginx server { listen 80; listen 443 ssl http2; @@ -490,7 +488,7 @@ server { ###### 反向代理(http) -``` +```nginx server { listen 80; listen 443 ssl http2; @@ -533,7 +531,7 @@ server { ###### 反向代理 tcn -``` +```nginx upstream tcp { server 127.0.0.1:3306; }