国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

Nginx隱藏版本號的方法

2024-08-30 12:23:56
字體:
來源:轉載
供稿:網友

Nginx隱藏版本號

在生產環境中,需要隱藏Nginx的版本號,以避免安全漏洞的泄露

查看方法

使用fiddler工具在Windows客戶端查看Nginx版本號
在centos系統中使用“curl -I 網址” 命令查看

Nginx隱藏版本號的方法

修改配置文件法
修改源碼法

一,安裝Nginx

1,在Linux上使用遠程共享獲取文件并掛載到mnt目錄下

[root@localhost ~]# smbclient -L //192.168.100.3/  ##遠程共享訪問Enter SAMBA/root's password:                 Sharename    Type   Comment                ---------    ----   -------                LNMP-C7     Disk    [root@localhost ~]# mount.cifs //192.168.100.3/LNMP-C7 /mnt ##掛載到/mnt目錄下

2,解壓源碼包到/opt下,并查看

[root@localhost ~]# cd /mnt  ##切換到掛載點目錄[root@localhost mnt]# lsDiscuz_X3.4_SC_UTF8.zip  nginx-1.12.2.tar.gzmysql-boost-5.7.20.tar.gz php-7.1.20.tar.gz[root@localhost mnt]# tar zxvf nginx-1.12.2.tar.gz -C /opt  ##解壓Nginx源碼包到/opt下[root@localhost mnt]# cd /opt/  ##切換到解壓的目錄下[root@localhost opt]# lsnginx-1.12.2 rh

3,安裝編譯需要的環境組件包

[root@localhost opt]# yum -y install /gcc /                    //c語言gcc-c++ /            //c++語言pcre-devel /           //pcre語言工具zlib-devel            //數據壓縮用的函式庫

4,創建程序用戶nginx并編譯Nginx

[root@localhost opt]# useradd -M -s /sbin/nologin nginx ##創建程序用戶,安全不可登陸狀態[root@localhost opt]# id nginxuid=1001(nginx) gid=1001(nginx) 組=1001(nginx)[root@localhost opt]# cd nginx-1.12.0/         ##切換到nginx目錄下[root@localhost nginx-1.12.0]# ./configure /     ##配置nginx> --prefix=/usr/local/nginx /    ##安裝路徑> --user=nginx /             ##用戶名> --group=nginx /            ##用戶組> --with-http_stub_status_module   ##狀態統計模塊

5,編譯和安裝

[root@localhost nginx-1.12.0]# make   ##編譯...[root@localhost nginx-1.12.0]# make install  ##安裝...[root@localhost nginx]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ ##創建軟連接讓系統識別nginx啟動腳本

6,制作管理腳本,便于使用service管理使用

[root@localhost nginx]# cd /etc/init.d/  ##切換到啟動配置文件目錄[root@localhost init.d]# lsfunctions netconsole network README[root@localhost init.d]# vim nginx     ##編輯啟動腳本文件#!/bin/bash# chkconfig: - 99 20                  ##注釋信息# description: Nginx Service Control ScriptPROG="/usr/local/nginx/sbin/nginx"      ##設置變量為nginx命令文件PIDF="/usr/local/nginx/logs/nginx.pid"    ##設置變量PID文件 進程號為5346case "$1" in         start)                $PROG                   ##開啟服務                ;;        stop)                kill -s QUIT $(cat $PIDF)      ##關閉服務                ;;        restart)                        ##重啟服務                $0 stop                $0 start                ;;        reload)                        ##重載服務                kill -s HUP $(cat $PIDF)                ;;        *)                              ##錯誤輸入提示                echo "Usage: $0 {start|stop|restart|reload}"               exit 1esacexit 0[root@localhost init.d]# chmod +x /etc/init.d/nginx  ##給啟動腳本執行權限[root@localhost init.d]# chkconfig --add nginx     ##添加到service管理器中[root@localhost init.d]# service nginx stop        ##就可以使用service控制nginx[root@localhost init.d]# service nginx start
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 赤城县| 托克托县| 秭归县| 钦州市| 磴口县| 临澧县| 蓬溪县| 新密市| 常山县| 乐都县| 德钦县| 绥中县| 五寨县| 沾益县| 白山市| 义乌市| 开化县| 清镇市| 台前县| 四子王旗| 吉林市| 扬州市| 秦皇岛市| 宣武区| 玉环县| 靖安县| 红原县| 汉源县| 长寿区| 虹口区| 吴江市| 桦南县| 确山县| 常山县| 龙里县| 广昌县| 清涧县| 肃北| 长汀县| 察隅县| 南涧|