暗影深渊 發表於 2022-4-30 21:22:00

Debian 安装 Nginx

<div>安敷依赖包:</div>
<div>apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring</div>
<p>&nbsp;</p>
<p>导入nginx 签名密钥:</p>
<div>curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg &gt;/dev/null</div>
<br>验证密钥:<br>
<pre>gpg --dry-run --quiet --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg</pre>
<div class="cnblogs_code">
<pre>pub   rsa2048 <span style="color: rgba(128, 0, 128, 1)">2011</span>-<span style="color: rgba(128, 0, 128, 1)">08</span>-<span style="color: rgba(128, 0, 128, 1)">19</span>
      573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
uid                      nginx signing key </span>&lt;signing-key@nginx.com&gt;</pre>
</div>
<p>&nbsp;</p>
<p>更新仓库文件:</p>
<div>echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" &nbsp; &nbsp;| tee /etc/apt/sources.list.d/nginx.list<br><br>固定存储库,以使我们的软件包优于发行版提供的软件包:<br>
<div>echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" | tee /etc/apt/preferences.d/99nginx</div>
</div>
<div>&nbsp;</div>
<div>开始安装:<br>
<div>apt update<br>apt install nginx</div>
</div>
<div class="cnblogs_code">
<pre>Preparing to unpack .../nginx_1.<span style="color: rgba(128, 0, 128, 1)">20.2</span>-<span style="color: rgba(128, 0, 128, 1)">1</span>~<span style="color: rgba(0, 0, 0, 1)">bullseye_amd64.deb ...
</span>----------------------------------------------------------------------<span style="color: rgba(0, 0, 0, 1)">

Thanks </span><span style="color: rgba(0, 0, 255, 1)">for</span> using nginx!<span style="color: rgba(0, 0, 0, 1)">

Please </span><span style="color: rgba(0, 0, 255, 1)">find</span> the official documentation <span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> nginx here:
</span>* https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">nginx.org/en/docs/</span>
<span style="color: rgba(0, 0, 0, 1)">
Please subscribe to nginx</span>-<span style="color: rgba(0, 0, 0, 1)">announce mailing list to get
the most important news about nginx:
</span>* https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">nginx.org/en/support.html</span>
<span style="color: rgba(0, 0, 0, 1)">
Commercial subscriptions </span><span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> nginx are available on:.................................................................................]
</span>* https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">nginx.com/products/</span>

----------------------------------------------------------------------<span style="color: rgba(0, 0, 0, 1)">
Unpacking nginx (</span><span style="color: rgba(128, 0, 128, 1)">1.20</span>.<span style="color: rgba(128, 0, 128, 1)">2</span>-<span style="color: rgba(128, 0, 128, 1)">1</span>~<span style="color: rgba(0, 0, 0, 1)">bullseye) ...
Setting up nginx (</span><span style="color: rgba(128, 0, 128, 1)">1.20</span>.<span style="color: rgba(128, 0, 128, 1)">2</span>-<span style="color: rgba(128, 0, 128, 1)">1</span>~<span style="color: rgba(0, 0, 0, 1)">bullseye) ...########################.....................................................................]
Created symlink </span>/etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/<span style="color: rgba(0, 0, 0, 1)">nginx.service........................]
Processing triggers </span><span style="color: rgba(0, 0, 255, 1)">for</span> <span style="color: rgba(0, 0, 255, 1)">man</span>-db (<span style="color: rgba(128, 0, 128, 1)">2.9</span>.<span style="color: rgba(128, 0, 128, 1)">4</span>-<span style="color: rgba(128, 0, 128, 1)">2</span>) ...##################################################################.......................]</pre>
</div>
<pre></pre>
<p>安装后缺省不运行,可通过以下命令使其运行:<br>systemctl start nginx</p>
<p>查看状态:<br>systemctl status nginx</p>
<div class="cnblogs_code">
<pre>● nginx.service - nginx -<span style="color: rgba(0, 0, 0, 1)"> high performance web server
   Loaded: loaded (</span>/lib/systemd/system/<span style="color: rgba(0, 0, 0, 1)">nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat </span><span style="color: rgba(128, 0, 128, 1)">2022</span>-<span style="color: rgba(128, 0, 128, 1)">04</span>-<span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">20</span>:<span style="color: rgba(128, 0, 128, 1)">55</span>:<span style="color: rgba(128, 0, 128, 1)">16</span><span style="color: rgba(0, 0, 0, 1)"> CST; 2s ago
       Docs: https:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">nginx.org/en/docs/</span>
    Process: <span style="color: rgba(128, 0, 128, 1)">18059</span> ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=<span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">SUCCESS)
   Main PID: </span><span style="color: rgba(128, 0, 128, 1)">18060</span><span style="color: rgba(0, 0, 0, 1)"> (nginx)
      Tasks: </span><span style="color: rgba(128, 0, 128, 1)">2</span> (limit: <span style="color: rgba(128, 0, 128, 1)">2242</span><span style="color: rgba(0, 0, 0, 1)">)
   Memory: </span><span style="color: rgba(128, 0, 128, 1)">1.7M</span><span style="color: rgba(0, 0, 0, 1)">
      CPU: 6ms
   CGroup: </span>/system.slice/<span style="color: rgba(0, 0, 0, 1)">nginx.service
             ├─</span><span style="color: rgba(128, 0, 128, 1)">18060</span> nginx: master process /usr/sbin/nginx -c /etc/nginx/<span style="color: rgba(0, 0, 0, 1)">nginx.conf
             └─</span><span style="color: rgba(128, 0, 128, 1)">18061</span><span style="color: rgba(0, 0, 0, 1)"> nginx: worker process

Apr </span><span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">20</span>:<span style="color: rgba(128, 0, 128, 1)">55</span>:<span style="color: rgba(128, 0, 128, 1)">16</span> iZrv8fu4iejmpkZ systemd[<span style="color: rgba(128, 0, 128, 1)">1</span>]: Starting nginx -<span style="color: rgba(0, 0, 0, 1)"> high performance web server...
Apr </span><span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">20</span>:<span style="color: rgba(128, 0, 128, 1)">55</span>:<span style="color: rgba(128, 0, 128, 1)">16</span> iZrv8fu4iejmpkZ systemd[<span style="color: rgba(128, 0, 128, 1)">1</span>]: nginx.service: Can<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">t open PID file /run/nginx.pid (yet?) after start: Operation not permitted</span>
Apr <span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">20</span>:<span style="color: rgba(128, 0, 128, 1)">55</span>:<span style="color: rgba(128, 0, 128, 1)">16</span> iZrv8fu4iejmpkZ systemd[<span style="color: rgba(128, 0, 128, 1)">1</span>]: Started nginx - high performance web server.</pre>
</div>
<p>&nbsp;</p>
<p>查看版本和配置:<br>nginx -V</p>
<div class="cnblogs_code">
<pre>nginx version: nginx/<span style="color: rgba(128, 0, 128, 1)">1.20</span>.<span style="color: rgba(128, 0, 128, 1)">2</span><span style="color: rgba(0, 0, 0, 1)">
built by </span><span style="color: rgba(0, 0, 255, 1)">gcc</span> <span style="color: rgba(128, 0, 128, 1)">10.2</span>.<span style="color: rgba(128, 0, 128, 1)">1</span> <span style="color: rgba(128, 0, 128, 1)">20210110</span> (Debian <span style="color: rgba(128, 0, 128, 1)">10.2</span>.<span style="color: rgba(128, 0, 128, 1)">1</span>-<span style="color: rgba(128, 0, 128, 1)">6</span><span style="color: rgba(0, 0, 0, 1)">)
built with OpenSSL </span><span style="color: rgba(128, 0, 128, 1)">1.1</span>.1k<span style="color: rgba(128, 0, 128, 1)">25</span> Mar <span style="color: rgba(128, 0, 128, 1)">2021</span> (running with OpenSSL <span style="color: rgba(128, 0, 128, 1)">1.1</span>.1n<span style="color: rgba(128, 0, 128, 1)">15</span> Mar <span style="color: rgba(128, 0, 128, 1)">2022</span><span style="color: rgba(0, 0, 0, 1)">)
TLS SNI support enabled
configure arguments: </span>--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-<span style="color: rgba(0, 0, 255, 1)">file</span>-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-<span style="color: rgba(0, 0, 255, 1)">cc</span>-opt=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">-g -O2 -ffile-prefix-map=/data/builder/debuild/nginx-1.20.2/debian/debuild-base/nginx-1.20.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC</span><span style="color: rgba(128, 0, 0, 1)">'</span> --with-<span style="color: rgba(0, 0, 255, 1)">ld</span>-opt=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie</span><span style="color: rgba(128, 0, 0, 1)">'</span></pre>
</div>
<p>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/workhelper/p/16211364.html
頁: [1]
查看完整版本: Debian 安装 Nginx