主頁 > 作業系統 > Linux之Nginx入門

Linux之Nginx入門

2022-01-04 06:04:46 作業系統

一、Nginx介紹

1.1 概述

Nginx是一個開源且高性能、可靠的http web服務、代理服務,

  • 開源:直接獲取源代碼

  • 高性能:支持海量并發

  • 可靠:服務穩定

1.2 Nginx特點

  • 高性能,高并發

    Nginx支持很高的并發,Nginx在處理大量并發的情況下比其他web服務要快

  • 輕量且高擴展性

    • 輕量:功能模塊少,只保留核心模塊,其他代碼模塊化 (易讀,便于二次開發,對于開發人員非常友好)
    • 高擴展性:需要什么模塊再安裝模塊,不需要全部安裝,并且還支持第三方模塊
  • 高可靠性

    只要不過分幾乎不會出現問題,其他的web服務需要每隔一段時間進行重啟,Nginx不需要;Nginx的宕機時間,是99999級別

  • 支持熱部署

    Nginx可以在運行期間,更新迭代,代碼部署,

  • 大多公司都在用Nginx

    • Nginx技術成熟,具備的功能是企業最常使用而且最需要的;
    • 適合當前主流架構趨勢, 微服務、云架構、中間層;
    • 統一技術堆疊, 降低維護成本, 降低技術更新成本;
  • Nginx使用的是Epoll網路模型

    • Select: 當用戶發起一次請求,select模型就會進行一次遍歷掃描,從而導致性能低下,
    • Epoll: 當用戶發起一次請求,epoll模型會直接進行處理,效率高效,并無連接限制,
  • Nginx應用場景

    img

1.3 其他web服務

  1. apache:httpd,最早期使用的web服務,性能不高,操作難
  2. nginx
    tengine:Tengine是由淘寶網發起的Web服務器專案,它在Nginx的基礎上,針對大訪問量網站的需求,添加了很多高級功能和特性
    openresty-nginx:OpenResty 是一個基于 Nginx 與 Lua 的高性能 Web 平臺,其內部集成了大量精良的 Lua 庫、第三方模塊以及大多數的依賴項,用于方便地搭建能夠處理超高并發、擴展性極高的動態 Web 應用、Web 服務和動態網關,
  3. IIS:windows下的web服務
  4. lighttpd:是一個德國人領導的開源 Web 服務器軟體,其根本的目的是提供一個專門針對高性能網站,安全、快速、兼容性好并且靈活的 Web Server 環境,具有非常低的記憶體開銷,CPU 占用率低,效能好,以及豐富的模塊等特點,
  5. GWS:google web server
  6. BWS:baidu web server

Tomcat
Resin
weblogic
Jboss

……

二、Nginx安裝

2.1 安裝方式

1.epol源安裝       web01
2.官方源安裝       web03
3.原始碼包安裝       web03
 
#三種安裝方式都需要安裝nginx運行的依賴環境
yum install -y gcc gcc-c++ autoconf pcre pcre-devel make automake wget httpd-tools vim tree

2.2 epol源安裝

[root@web01 ~]# yum install -y nginx

2.3 官方源安裝

配置官方源:

#配置官方源: 
[root@web02 ~]# vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
 
 
#下載:  
[root@web02 ~]# yum install -y nginx

2.4 原始碼包安裝

  1. 下載安裝包

    [root@web03 ~]# wget https://nginx.org/download/nginx-1.20.2.tar.gz
    
  2. 解壓原始碼包

    [root@web03 ~]# tar -xf nginx-1.20.2.tar.gz 
    
  3. 配置安裝的環境(運行用戶,安裝目錄等)

    1.創建用戶和組,且不創建用戶的家目錄
    [root@web03 ~]# groupadd www -g 666
    [root@web03 ~]# useradd www -u 666 -g 666 -s /sbin/nologin -M
     
    2.創建一個安裝目錄
    公司不指定安裝目錄時,默認安裝到/usr/local/軟體名/
    公司指定的話,就要按照公司要求來
    
  4. 生成Makefile

    [root@web03 ~/nginx-1.20.2]# cd nginx-1.20.2/
    [root@web03 ~/nginx-1.20.2]# ./configure --prefix=/usr/local/nginx-1.20.2 --user=www --group=www --without-http_gzip_module
    
  5. 編譯安裝,結束后去安裝目錄查看安裝結果

    1.編譯安裝
    [root@web03 nginx-1.20.2]# make && make install
     
    2.查看安裝結果
    [root@web03 /usr/local]# cd /usr/local/nginx-1.20.2/
    [root@web03 /usr/local/nginx-1.20.2]# ll
    
  6. 做軟鏈接

    [root@web03 /usr/local/nginx-1.20.2]# ln -s /usr/local/nginx-nginx-1.20.2 /usr/local/nginx
    
  7. 配置環境變數

    [root@web03 ~]# vim /etc/profile.d/nginx.sh
    export PATH=$PATH:/usr/local/nginx/sbin
    ~                                      
    [root@web03 ~]# source /etc/profile         #在當前bash環境下讀取并執行/etc/profile中的命令
    
  8. system管理配置

    #原始碼包安裝后沒有辦法使用system管理,需要我們自己配置
    [root@web03 /usr/lib/systemd/system]# vim /usr/lib/systemd/system/nginx.service
    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs/
    After=network-online.target remote-fs.target nss-lookup.target
    Wants=network-online.target
     
    [Service]
    Type=forking
    PIDFile=/usr/local/nginx/logs/nginx.pid
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/usr/local/nginx/sbin/nginx -s reload
    ExecStop=/usr/local/nginx/sbin/nginx -s stop
     
    [Install]
    WantedBy=multi-user.target
     
    [root@web03 ~]# systemctl daemon-reload                 #加載新的unit (*.service)組態檔
    

三、Nginx命令

nginx #啟動nginx, 等價于systemctl start nginx
 
nginx -s reopen #重啟Nginx,   等價于systemctl restart nginx
 
nginx -s reload #重新加載Nginx組態檔,然后以優雅的方式重啟Nginx, 等價于systemctl reload nginx
 
nginx -s stop #強制停止Nginx服務, 等價于systemctl stop nginx
 
nginx -s quit #優雅地停止Nginx服務(即處理完所有請求后再停止服務)
 
nginx -t #檢測組態檔是否有語法錯誤,然后退出
 
nginx -?,-h #打開幫助資訊
 
nginx -v #顯示版本號資訊并退出
 
nginx -V #顯示版本號和配置選項資訊,然后退出
 
nginx -V 2>&1 | sed "s/\s\+--/\n --/g" #模塊分行輸出,格式化輸出
 
killall nginx #殺死所有nginx行程
 
systemctl enable nginx  #加入開機自啟動
    Centos6:
        啟動:nginx
            service nginx start
            /etc/init.d/nginx start
        加入開機自啟:
            chkconfig nginx on
 
nginx -T #檢測組態檔是否有語法錯誤,轉儲并退出
 
nginx -q #在檢測組態檔期間屏蔽非錯誤資訊(列印錯誤日志)
 
nginx -p prefix #設定nginx的作業目錄(默認是:/usr/share/nginx/)
 
nginx -c filename #設定組態檔路徑(默認是:/etc/nginx/nginx.conf)
 
nginx -g directives #設定組態檔外的全域指令

四、Nginx服務平滑無感知添加模塊和升級

4.1 模塊決議

[root@web02 ~]# nginx -V        #顯示版本和配置選項資訊,然后退出
nginx version: nginx/1.20.2     
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/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-file-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-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie
 
############################內容決議#######################################
 
nginx version: nginx/1.20.2                 #nginx版本
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)    
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments:
 --prefix=/etc/nginx            #nginx檔案的安裝路徑,其它選項如果使用相對路徑,那么以此路徑為基礎路徑
 --sbin-path=/usr/sbin/nginx    #二進制程式的安裝目錄
 --modules-path=/usr/lib64/nginx/modules    #模塊安裝路徑
 --conf-path=/etc/nginx/nginx.conf  #設定nginx的conf檔案路徑
 --error-log-path=/var/log/nginx/error.log  #設定nginx錯誤日志路徑
 --http-log-path=/var/log/nginx/access.log  #設定nginx的訪問日志路徑
 --pid-path=/var/run/nginx.pid  #設定nginx的pid檔案路徑
 --lock-path=/var/run/nginx.lock    #設定lock檔案臨時存放的路徑
 --http-client-body-temp-path=/var/cache/nginx/client_temp  #設定http客戶端主體臨時快取路徑
 --http-proxy-temp-path=/var/cache/nginx/proxy_temp     #設定http反向代理臨時路徑
 --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp     #設定http的fastcgi臨時快取路徑
 --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp #設定uwsgi臨時目錄
 --http-scgi-temp-path=/var/cache/nginx/scgi_temp   #scgi臨時存放目錄
 --user=nginx   #設定啟動 worker 行程時所使用的非特權用戶名
 --group=nginx  #設定啟動 worker 行程時所使用的非特權用戶組名
 --with-compat
 --with-file-aio
 --with-threads
	......

4.2 Nginx服務添加模塊

1.安裝依賴
[root@web02 nginx-1.20.2]# yum install -y openssl openssl-devel
 
2.再生成一次
[root@web02 nginx-1.20.2]# ./configure --prefix=/usr/local/nginx-1.20.2-new --user=www --group=www --without-http_gzip_module --with-compat --with-file-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-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
 
3.安裝
[root@web02 nginx-1.20.2]# make && make install
 
4.重做軟連接
[root@web02 ~]# rm -rf /usr/local/nginx && ln -s /usr/local/nginx-1.20.2-new /usr/local/nginx
 
5.重啟服務
[root@web02 nginx-1.20.2]# systemctl restart nginx

4.3 Nginx升級

1.下載新版本的包
[root@web02 ~]# wget http://nginx.org/download/nginx-1.20.2.tar.gz
 
2.解壓
[root@web02 ~]# tar xf nginx-1.20.2.tar.gz
 
3.生成
[root@web02 nginx-1.20.2]# cd nginx-1.20.2
[root@web02 nginx-1.20.2]# ./configure --prefix=/usr/local/nginx-1.20.2 --user=www --group=www --without-http_gzip_module --with-compat --with-file-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
 
4.編譯安裝
[root@web02 nginx-1.20.2]# make && make install
 
5.重做軟連接
[root@web02 ~]# rm -rf /usr/local/nginx && ln -s /usr/local/nginx-1.20.2 /usr/local/nginx
 
6.重啟服務
[root@web02 ~]# systemctl restart nginx

五、Nginx相關檔案

為了讓大家更清晰的了解Nginx軟體的全貌,可使用rpm -ql nginx查看整體的目錄結構及對應的功能,如下表格整理了Nginx比較重要的組態檔,

5.1 Nginx主組態檔

路徑 型別 作用
/etc/nginx/nginx.conf 組態檔 nginx主組態檔
/etc/nginx/conf.d/default.conf 組態檔 默認網站組態檔

5.2Nginx代理相關引數檔案

路徑 型別 作用
/etc/nginx/fastcgi_params 組態檔 Fastcgi代理組態檔
/etc/nginx/scgi_params 組態檔 scgi代理組態檔
/etc/nginx/uwsgi_params 組態檔 uwsgi代理組態檔

5.3 Nginx編碼相關組態檔

路徑 型別 作用
/etc/nginx/win-utf 組態檔 Nginx編碼轉換映射檔案
/etc/nginx/koi-utf 組態檔 Nginx編碼轉換映射檔案
/etc/nginx/koi-win 組態檔 Nginx編碼轉換映射檔案
/etc/nginx/mime.types 組態檔 Content-Type與擴展名

5.4 Nginx管理相關命令

路徑 型別 作用
/usr/sbin/nginx 命令 Nginx命令列管理終端工具
/usr/sbin/nginx-debug 命令 Nginx命令列與終端除錯工具

5.5 Nginx日志相關目錄與檔案

路徑 型別 作用
/var/log/nginx 目錄 Nginx默認存放日志目錄
/etc/logrotate.d/nginx 組態檔 Nginx默認的日志切割

六、Nginx組態檔

Nginx主組態檔/etc/nginx/nginx.conf是一個純文本型別的檔案,整個組態檔是以區塊的形式組織的,一般,每個區塊以一對大括號{}來表示開始與結束,

Nginx主組態檔整體分為三塊進行學習,分別是CoreModule(核心模塊),EventModule(事件驅動模塊),HttpCoreModule(http內核模塊)

組態檔內容:

[root@web01 ~]# cat /etc/nginx/nginx.conf 
#########################核心模塊####################
#指定啟動的用戶
user  www;
#nginx的worker行程的數量,auto==CPU數量
worker_processes  auto;
#指定錯誤日志存放的路徑以及記錄的級別 debug/info/notice/warn/error/emerg
error_log  /var/log/nginx/error.log notice;
#指定pid檔案
pid        /var/run/nginx.pid;
 
########################事件驅動模塊#################
events {
    #每個worker作業行程的最大連接數
    worker_connections  1024;
}
 
######################http內核模塊###################
http {
    #包含,nginx可識別的檔案型別
    include       /etc/nginx/mime.types;
    #當nginx不識別檔案型別的時候,默認下載
    default_type  application/octet-stream;
    #指定日志格式,日志格式起個名字
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    #指定訪問日志存盤路徑與格式
    access_log  /var/log/nginx/access.log  main;
    #高效傳輸
    sendfile        on;
    #高效傳輸
    #tcp_nopush     on;
    #開啟長連接
    keepalive_timeout  65;
    #開啟壓縮
    #gzip  on;
    #包含網站的組態檔
    include /etc/nginx/conf.d/*.conf;
 
    #一個server表示一個網站
    server {
        #監聽埠
        listen       80;
        #網站提供的域名
        server_name  localhost;
        #字符集
        charset utf8;
        #匹配、控制訪問的網站站點
        location / {
            #指定站點目錄
            root   /usr/share/nginx/html;
            #指定默認訪問的頁面
            index  index.html index.htm;
        }
    }
}
access_log /var/log/nginx/access.log json ;

日志格式可以用下面的json格式,更加清晰明了:

log_format json '{"@timestamp":"$time_iso8601",'
          '"host":"$server_addr",'
          '"service":"nginxTest",'
          '"trace":"$upstream_http_ctx_transaction_id",'
          '"log":"log",'
          '"clientip":"$remote_addr",'
          '"remote_user":"$remote_user",'
          '"request":"$request",'
          '"http_user_agent":"$http_user_agent",'
          '"size":$body_bytes_sent,'
          '"responsetime":$request_time,'
          '"upstreamtime":"$upstream_response_time",'
          '"upstreamhost":"$upstream_addr",'
          '"http_host":"$host",'
          '"url":"$uri",'
          '"domain":"$host",'
          '"xff":"$http_x_forwarded_for",'
          '"referer":"$http_referer",'
          '"status":"$status"}';

七、搭建小游戲案例

7.1 撰寫史上最簡單配置

[root@web01 ~]# vim /etc/nginx/conf.d/game.conf
server {
    listen 80;
    server_name www.mario.com;
    #server_name localhost;
    location / {
        root /opt/Super_Marie;
        index index.html;
    }
}

7.2 檢查組態檔

[root@web01 code]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

7.3 創建站點目錄

[root@web01 ~]# mkdir -p /opt/Super_Marie

7.4 上傳代碼包

[root@web01 ~]# cd /opt/Super_Marie
[root@web01 Super_Marie]# rz
[root@web01 Super_Marie]# unzip mario.zip

7.5 多載Nginx

[root@web01 Super_Marie]# systemctl restart nginx

7.6 配置Windows下的hosts(域名決議)

Windows中hosts檔案所在位置:
C:\Windows\System32\drivers\etc\hosts

172.16.1.7 www.mario.com

7.7 瀏覽器上訪問頁面玩游戲

八、再搭建一個游戲

8.1 編輯組態檔

[root@web01 ~]# vim /etc/nginx/conf.d/gametwo.conf 
server {
    listen 80;
    server_name www.tank.com;
 
    location / {
        root /opt/tank;
        index index.html;
    }
}
 
[root@web01 opt]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
 
[root@web01 ~]# mkdir -p /opt/tank
 
[root@web01 opt]# systemctl restart nginx

8.2 上傳代碼

[root@web01 ~]# cd /opt/tank
[root@web01 tank]# rz
[root@web01 tank]# unzip tankedazhan.zip

8.3 配置Windows下的hosts

C:\Windows\System32\drivers\etc\hosts

172.16.1.7 www.mario.com www.tank.com

8.4 瀏覽器上輸入不同域名地址訪問對應頁面進行游戲

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/402392.html

標籤:Linux

上一篇:CentOS7.6下安裝Redis5.0.7

下一篇:STM32(1):點亮LED(上)

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more