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

首頁 > 網(wǎng)站 > Nginx > 正文

nginx訪問控制的實現(xiàn)示例

2024-08-30 12:23:57
字體:
供稿:網(wǎng)友

關(guān)于Nginx一款高性能,輕量級web服務(wù)軟件

穩(wěn)定性高
系統(tǒng)資源消耗低
對HTTP并發(fā)連接的處理能力高

單臺物理服務(wù)器可支持30000~50000個并發(fā)請求

環(huán)境

一臺Linux服務(wù)器(192.168.13.128) 一臺win10測試機

一,在Windows上將LAMP所需壓縮軟件包共享出來(此處如有問題請看之前的博客相關(guān)文章)

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

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

三,編譯安裝Nginx

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

[root@localhost ~]# cd /mnt ##切換到掛載點目錄[root@localhost mnt]# lsapr-1.6.2.tar.gz     Discuz_X2.5_SC_UTF8.zip LAMP-php5.6.txtapr-util-1.6.0.tar.gz    error.png    mysql-5.6.26.tar.gzawstats-7.6.tar.gz    httpd-2.4.29.tar.bz2  nginx-1.12.0.tar.gzcronolog-1.6.2-14.el7.x86_64.rpm kali.jpg     php-5.6.11.tar.bz2[root@localhost mnt]# tar zxvf nginx-1.12.0.tar.gz -C /opt ##解壓Nginx源碼包到/opt下[root@localhost mnt]# cd /opt/ ##切換到解壓的目錄下[root@localhost opt]# lsnginx-1.12.0 rh

2,安裝編譯需要的環(huán)境組件包

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

3,創(chuàng)建程序用戶nginx并編譯Nginx

[root@localhost opt]# useradd -M -s /sbin/nologin nginx ##創(chuàng)建程序用戶,安全不可登陸狀態(tài)[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  ##狀態(tài)統(tǒng)計模塊

4,編譯和安裝

[root@localhost nginx-1.12.0]# make  ##編譯...[root@localhost nginx-1.12.0]# make install ##安裝...

5,優(yōu)化nginx啟動腳本,以便于系統(tǒng)識別

[root@localhost nginx]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ ##創(chuàng)建軟連接讓系統(tǒng)識別nginx啟動腳本[root@localhost nginx]# nginx -t  ##檢查配置文件的語法問題nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[root@localhost nginx]# nginx  ##開啟ngnix[root@localhost nginx]# netstat -ntap | grep 80  ##查看端口,nginx已經(jīng)開啟tcp  0  0 0.0.0.0:80    0.0.0.0:*    LISTEN  39620/nginx: master [root@localhost nginx]# systemctl stop firewalld.service ##關(guān)閉防火墻[root@localhost nginx]# setenforce 0 

6,安裝elinks網(wǎng)頁測試工具,并進行測試

[root@localhost nginx]# yum install elinks -y ##安裝elinks軟件[root@localhost nginx]# elinks http://localhost ##測試nginx網(wǎng)頁
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 衡水市| 绍兴市| 惠水县| 永仁县| 米泉市| 湛江市| 苗栗县| 大连市| 自治县| 同江市| 西贡区| 邛崃市| 全椒县| 永修县| 望都县| 额敏县| 衡阳市| 五寨县| 建始县| 洞头县| 长宁县| 阿克陶县| 呈贡县| 甘德县| 砚山县| 塔城市| 田东县| 临湘市| 大同县| 奎屯市| 洪雅县| 浮梁县| 杨浦区| 乌兰察布市| 甘肃省| 通州市| 金华市| 焦作市| 绥棱县| 滁州市| 青铜峡市|