<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Nginx on Net Boy</title>
    <link>https://lian.st/tags/nginx/</link>
    <description>Recent content in Nginx on Net Boy</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-gb</language>
    <lastBuildDate>Wed, 16 Oct 2024 23:32:15 +0800</lastBuildDate><atom:link href="https://lian.st/tags/nginx/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>FreeBSD编译安装openresty</title>
      <link>https://lian.st/posts/af40f8f4/</link>
      <pubDate>Wed, 16 Oct 2024 23:32:15 +0800</pubDate>
      
      <guid>https://lian.st/posts/af40f8f4/</guid>
      
      <description>&lt;h2 id=&#34;环境信息&#34;&gt;环境信息&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;OS Version : freeBSD 14
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;下载openresty&#34;&gt;下载openresty&lt;/h2&gt;
&lt;p&gt;freebsd 自带的fetch太慢了，还是用回wget吧.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;wget https://openresty.org/download/openresty-1.25.3.2.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;创建运行用户&#34;&gt;创建运行用户&lt;/h2&gt;
&lt;p&gt;创建一个普通用户&lt;code&gt;www&lt;/code&gt;用来作为&lt;code&gt;openresty&lt;/code&gt;运行的用户.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adduser www
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;安装依赖&#34;&gt;安装依赖&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;下面依赖包根据实时版本安装，下面列出来的版本号不是一成不变的.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@nl:/data/openresty-1.25.3.2 # pkg install cmake-3.30.5  perl5-5.36.3_2  gcc-13_5 make++-2.0_1 pcre-8.45_4 zlib-ng-2.2.2  openssl-3.0.15,1 git-2.46.2 make++-2.0_1 gmake-4.4.1
&lt;/code&gt;&lt;/pre&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;brotli&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone --recurse-submodules https://github.com/google/ngx_brotli
cd ngx_brotli/deps/brotli
mkdir out &amp;amp;&amp;amp; cd out
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=&amp;#34;-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections&amp;#34; -DCMAKE_CXX_FLAGS=&amp;#34;-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections&amp;#34; -DCMAKE_INSTALL_PREFIX=./installed ..
cmake --build . --config Release --target brotlienc


# nginx vhost config
...
    #启用brotli压缩
    brotli on;
    brotli_comp_level 6;
    brotli_buffers 16 8k;
    brotli_min_length 20;
    # 注意要配置压缩的文件类型(content-type)
    brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml application/wasm application/octet-stream;  
..
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;编译安装&#34;&gt;编译安装&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@nl:/data/openresty-1.25.3.2 # ./configure --prefix=/usr/local/openresty \
            --with-http_ssl_module \
            --with-http_gzip_static_module \
            --with-http_realip_module \
            --with-stream \
            --with-stream_ssl_module \
            --with-http_secure_link_module \
            --with-http_sub_module \
            --with-http_v2_module \
            --with-http_dav_module \
            --add-module=/data/ngx_brotli
root@nl:/data/openresty-1.25.3.2 #  gmake &amp;amp;&amp;amp; gmake install
root@localhost:/data/software/openresty-1.25.3.2 # ln -snf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;验证安装&#34;&gt;验证安装&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@localhost:/data/software/openresty-1.25.3.2 # nginx -v
nginx version: openresty/1.25.3.2
root@localhost:/data/software/openresty-1.25.3.2 # nginx
root@localhost:/usr/local/openresty/nginx/conf # netstat -anl | grep 80
tcp4       0      0 192.168.30.200.80                              192.168.30.120.43858                           FIN_WAIT_2 
tcp4       0      0 192.168.30.200.80                              192.168.30.120.56748                           TIME_WAIT  
tcp4       0      0 *.80                                          *.*                                           LISTEN     
tcp4       0     36 192.168.30.200.22                              192.168.30.120.38036         
root@localhost:/usr/local/openresty/nginx/conf # ps aux | grep nginx
root  18668   0.0  1.1 23596 10580  -  Is   07:29    0:00.00 nginx: master process nginx (nginx)
www   18669   0.0  1.5 30252 15032  -  S    07:29    0:00.01 nginx: worker process (nginx)
root  18678   0.0  0.2 12808  2000  0  S+   07:31    0:00.00 grep nginx
&lt;/code&gt;&lt;/pre&gt;</description>
      
    </item>
    
    <item>
      <title>Rockylinx9 Install Angie</title>
      <link>https://lian.st/posts/rockylinx9-install-angie/</link>
      <pubDate>Thu, 03 Oct 2024 00:40:23 +0800</pubDate>
      
      <guid>https://lian.st/posts/rockylinx9-install-angie/</guid>
      
      <description>&lt;p&gt;&lt;img alt=&#34;anangie&#34; src=&#34;https://b2.ccc.re/2024/07/27/angie.png&#34;&gt;&lt;/p&gt;
&lt;h1 id=&#34;what-is-angie&#34;&gt;what is Angie&lt;/h1&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Angie /&lt;a href=&#34;https://en.wikipedia.org/wiki/International_Phonetic_Alphabet&#34;&gt;ˈendʒi&lt;/a&gt;/ is an efficient, powerful, and scalable web server that was forked from nginx&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Conceived by ex-devs from the original team to venture beyond the earlier vision and act as a &lt;a href=&#34;https://angie.software/en/configuration/migration/#howto-migration&#34;&gt;drop-in replacement&lt;/a&gt; without major changes to module setup or configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Includes all capabilities of &lt;a href=&#34;https://nginx.org/en/CHANGES&#34;&gt;nginx 1.27.0&lt;/a&gt; and a number of &lt;a href=&#34;https://angie.software/en/#index-features-oss&#34;&gt;new features&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h1 id=&#34;install&#34;&gt;Install&lt;/h1&gt;
&lt;p&gt;Angie provides Dokker images, binary packages, source code, and other ways to install them, so I like to use source code to compile the installation.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>Nginx隐藏版本号</title>
      <link>https://lian.st/posts/b387f540/</link>
      <pubDate>Thu, 09 Feb 2023 20:18:50 +0800</pubDate>
      
      <guid>https://lian.st/posts/b387f540/</guid>
      
      <description>&lt;h2 id=&#34;修改&#34;&gt;修改&lt;/h2&gt;
&lt;p&gt;編輯你的nginx主配置文件，新增server_tokens off;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; 53         gzip_vary on;
 54         gzip_proxied   expired no-cache no-store private auth;
 55         gzip_disable   &amp;#34;MSIE [1-6]\.&amp;#34;;
 56 
 57         #limit_conn_zone $binary_remote_addr zone=perip:10m;
 58         ##If enable limit_conn_zone,add &amp;#34;limit_conn perip 10;&amp;#34; to server section.
 59 
 60         server_tokens off;  # 設定爲off即可隱藏nginx版本號
 61         access_log off;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;生效&#34;&gt;生效&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nginx -t 
nginx -s reload
&lt;/code&gt;&lt;/pre&gt;</description>
      
    </item>
    
  </channel>
</rss>
