穩(wěn)定性高
系統(tǒng)資源消耗低
對HTTP并發(fā)連接的處理能力高
[root@localhost ~]# smbclient -L //192.168.100.50/
Enter SAMBA\root's password:
OS=[Windows 10 Enterprise LTSC 2019 17763] Server=[Windows 10 Enterprise LTSC 2019 6.3]
Sharename Type Comment
--------- ---- -------
IPC$ IPC 遠程 IPC
share Disk
tools Disk
Users Disk
Connection to 192.168.100.50 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available
[root@localhost ~]# mkdir /mnt/tools
[root@localhost ~]# mount.cifs //192.168.100.50/tools /mnt/tools/
Password for root@//192.168.100.50/tools:
[root@localhost ~]# cd /mnt/tools/
[root@localhost tools]# ls
awstats-7.6.tar.gz extundelete-0.2.4.tar.bz2 forbid.png jdk-8u191-windows-x64.zip LAMP-C7 picture.jpg
cronolog-1.6.2-14.el7.x86_64.rpm fiddler.exe intellijideahahau2018.rar john-1.8.0.tar.gz LNMP
[root@localhost tools]#
[root@localhost tools]# cd LNMP/
[root@localhost LNMP]# ls
Discuz_X3.4_SC_UTF8.zip mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz php-7.1.20.tar.gz
[root@localhost LNMP]# tar zxvf nginx-1.12.2.tar.gz -C /opt/
.......//省略解壓過程
[root@localhost LNMP]# yum -y install gcc gcc-c++ pcre-devel zlib-devel
........//省略安裝過程
[root@localhost LNMP]#
[root@localhost LNMP]# useradd -M -s /sbin/nologin nginx //-M,不創(chuàng)建家目錄
[root@localhost LNMP]# id nginx //查看nginx用戶
uid=1001(nginx) gid=1001(nginx) 組=1001(nginx)
[root@localhost LNMP]#
[root@localhost LNMP]# cd /opt/nginx-1.12.2/
[root@localhost nginx-1.12.2]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@localhost nginx-1.12.2]# ./configure \
> --prefix=/usr/local/nginx \ //安裝路徑
> --user=nginx \ //屬主
> --group=nginx \ //屬組
> --with-http_stub_status_module //開啟統(tǒng)計模塊
........//省略配置過程
[root@localhost nginx-1.12.2]# make && make install
.........//省略編譯過程
[root@localhost nginx-1.12.2]#
[root@localhost nginx-1.12.2]# cd /usr/local/nginx/
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
[root@localhost sbin]#
[root@localhost sbin]# nginx -t //檢查測試配置文件
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost sbin]# nginx //開啟服務(wù)
[root@localhost sbin]# netstat -ntap | grep 80 //查看80端口
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 52709/nginx: master
[root@localhost sbin]#
[root@localhost sbin]# systemctl stop firewalld.service //關(guān)閉防火墻
[root@localhost sbin]# setenforce 0 //關(guān)閉增強性安全功能
[root@localhost sbin]#
[root@localhost sbin]# yum install elinks -y //安裝工具
.........//省略安裝過程
[root@localhost sbin]#
[root@localhost sbin]# elinks http://localhost //測試能否訪問nginx服務(wù)
[root@localhost sbin]# service nginx stop //停止服務(wù)
[root@localhost sbin]# netstat -ntap | grep 80 //查看80端口,無
[root@localhost sbin]# service nginx start //開啟服務(wù)
[root@localhost sbin]# netstat -ntap | grep 80 //查看80端口,有
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 53614/nginx: master
[root@localhost sbin]#
[root@localhost sbin]# vim /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm;
}
location /status {
stub_status on;
access_log off;
}
[root@localhost sbin]# service nginx stop
[root@localhost sbin]# service nginx start
[root@localhost sbin]#
[root@localhost sbin]# vim /usr/local/nginx/conf/nginx.conf
location / {
auth_basic "secret";
auth_basic_user_file /usr/local/nginx/passwd.db;
root html;
index index.html index.htm;
}
location /status {
stub_status on;
access_log off;
}
[root@localhost sbin]#
[root@localhost sbin]# yum install httpd-tools -y
........//省略安裝過程
[root@localhost sbin]#
[root@localhost sbin]# htpasswd -c /usr/local/nginx/passwd.db test
New password:
Re-type new password:
Adding password for user test
[root@localhost sbin]# cat /usr/local/nginx/passwd.db
test:$apr1$od5a34WH$MduYUJbQ2W0oihB0Bs/bx.
[root@localhost sbin]#
[root@localhost sbin]# service nginx stop
[root@localhost sbin]# service nginx start
[root@localhost sbin]#
高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
本文名稱:源碼編譯安裝Nginx服務(wù)及訪問控制(實戰(zhàn)!)-創(chuàng)新互聯(lián)
鏈接URL:http://sd-ha.com/article10/goggo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、微信公眾號、定制網(wǎng)站、商城網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容