您好,登錄后才能下訂單哦!
穩(wěn)定性高
系統(tǒng)資源消耗低
對(duì)HTTP并發(fā)連接的處理能力高
- 單臺(tái)物理服務(wù)器可支持30000~50000個(gè)并發(fā)請(qǐng)求
一臺(tái)Linux服務(wù)器(192.168.13.128)
一臺(tái)win10測(cè)試機(jī)
[root@localhost ~]# smbclient -L //192.168.100.3/ ##遠(yuǎn)程共享訪問(wèn)
Enter SAMBA\root's password:
Sharename Type Comment
--------- ---- -------
LAMP-C7 Disk
[root@localhost ~]# mount.cifs //192.168.100.3/LAMP-C7 /mnt ##掛載到/mnt目錄下
[root@localhost ~]# cd /mnt ##切換到掛載點(diǎn)目錄
[root@localhost mnt]# ls
apr-1.6.2.tar.gz Discuz_X2.5_SC_UTF8.zip LAMP-php5.6.txt
apr-util-1.6.0.tar.gz error.png mysql-5.6.26.tar.gz
awstats-7.6.tar.gz httpd-2.4.29.tar.bz2 nginx-1.12.0.tar.gz
cronolog-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]# ls
nginx-1.12.0 rh
[root@localhost opt]# yum -y install \
gcc \ //c語(yǔ)言
gcc-c++ \ //c++語(yǔ)言
pcre-devel \ //pcre語(yǔ)言工具
zlib-devel //數(shù)據(jù)壓縮用的函式庫(kù)
[root@localhost opt]# useradd -M -s /sbin/nologin nginx ##創(chuàng)建程序用戶(hù),安全不可登陸狀態(tài)
[root@localhost opt]# id nginx
uid=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 \ ##用戶(hù)名
> --group=nginx \ ##用戶(hù)組
> --with-http_stub_status_module ##狀態(tài)統(tǒng)計(jì)模塊
[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/ ##創(chuàng)建軟連接讓系統(tǒng)識(shí)別nginx啟動(dòng)腳本
[root@localhost nginx]# nginx -t ##檢查配置文件的語(yǔ)法問(wèn)題
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 nginx]# nginx ##開(kāi)啟ngnix
[root@localhost nginx]# netstat -ntap | grep 80 ##查看端口,nginx已經(jīng)開(kāi)啟
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
[root@localhost nginx]# yum install elinks -y ##安裝elinks軟件
[root@localhost nginx]# elinks http://localhost ##測(cè)試nginx網(wǎng)頁(yè)
- 啟用HTTP_STUB_STATUS狀態(tài)統(tǒng)計(jì)模塊
- nginx -V可以查看已安裝的Nginx是否包含統(tǒng)計(jì)模塊
[root@localhost ~]# cd /usr/local/nginx/conf ##切換到配置文件目錄
[root@localhost conf]# vim nginx.conf ##修改Nginx配置文件
server {
listen 80;
server_name www.kgc.com; ##指明一個(gè)域名
charset utf-8; ##中文字符集
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /status { ##添加狀態(tài)統(tǒng)計(jì)
stub_status on;
access_log off;
}
[root@localhost conf]# yum install bind -y ##安裝DNS服務(wù)
[root@localhost conf]# vim /etc/named.conf ##主配置文件
options {
listen-on port 53 { any; }; ##將本機(jī)監(jiān)聽(tīng)為所有
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; }; ##允許所有
[root@localhost conf]# vim /etc/named.rfc1912.zones ##配置區(qū)域配置文件
zone "localhost" IN { ##復(fù)制模板到下面
type master;
file "named.localhost";
allow-update { none; };
};
zone "kgc.com" IN { ##修改localhost為kgc.com
type master;
file "kgc.com.zone"; ##創(chuàng)建區(qū)域數(shù)據(jù)配置文件
allow-update { none; };
};
[root@localhost conf]# cd /var/named
[root@localhost named]# cp -p named.localhost kgc.com.zone
##復(fù)制模板為kgc.com.zone
[root@localhost named]# vim kgc.com.zone ##編輯區(qū)域數(shù)據(jù)配置文件
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
www IN A 192.168.13.128 ##刪除ipv6 添加域名解析地址為本機(jī)
[root@localhost named]# systemctl start named ##開(kāi)啟dns服務(wù)
[root@localhost named]# systemctl stop firewalld.service ##關(guān)閉防火墻
[root@localhost named]# setenforce 0 ##關(guān)閉增強(qiáng)功能
[root@localhost conf]# yum install httpd-tools -y ##安裝工具包
[root@localhost conf]# htpasswd -c /usr/local/nginx/passwd.db test ##設(shè)置密碼認(rèn)證文件
New password: ##輸入密碼
Re-type new password: ##確認(rèn)密碼
Adding password for user test
[root@localhost conf]# cat /usr/local/nginx/passwd.db ##查看密碼認(rèn)證文件
test:$apr1$LqqHZeX3$24E7/HeacTVRzKA7nvSgY/
[root@localhost conf]# service nginx stop ##關(guān)閉服務(wù)
[root@localhost conf]# service nginx start ##開(kāi)啟服務(wù)
向AI問(wèn)一下細(xì)節(jié)
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。