穩(wěn)定性高
系統(tǒng)資源消耗低
對(duì)HTTP并發(fā)連接的處理能力高成都創(chuàng)新互聯(lián)執(zhí)著的堅(jiān)持網(wǎng)站建設(shè),微信小程序定制開發(fā);我們不會(huì)轉(zhuǎn)行,已經(jīng)持續(xù)穩(wěn)定運(yùn)營十載。專業(yè)的技術(shù),豐富的成功經(jīng)驗(yàn)和創(chuàng)作思維,提供一站式互聯(lián)網(wǎng)解決方案,以客戶的口碑塑造品牌,攜手廣大客戶,共同發(fā)展進(jìn)步。
- 單臺(tái)物理服務(wù)器可支持30000~50000個(gè)并發(fā)請(qǐng)求
一臺(tái)Linux服務(wù)器(192.168.13.128)
一臺(tái)win10測(cè)試機(jī)
[root@localhost nginx]# killall -s QUIT nginx ##停止 或者使用killall -3 nginx
[root@localhost nginx]# killall -s HUP nginx ##重啟 或者使用killall -1 nginx
[root@localhost nginx]# nginx ##開啟
[root@localhost nginx]# cd /etc/init.d/ ##切換到啟動(dòng)配置文件目錄
[root@localhost init.d]# ls
functions netconsole network README
[root@localhost init.d]# vim nginx ##編輯啟動(dòng)腳本文件
#!/bin/bash
# chkconfig: - 99 20 ##注釋信息
# description: Nginx Service Control Script
PROG="/usr/local/nginx/sbin/nginx" ##設(shè)置變量為nginx命令文件
PIDF="/usr/local/nginx/logs/nginx.pid" ##設(shè)置變量PID文件 進(jìn)程號(hào)為5346
case "$1" in
start)
$PROG ##開啟服務(wù)
;;
stop)
kill -s QUIT $(cat $PIDF) ##關(guān)閉服務(wù)
;;
restart) ##重啟服務(wù)
$0 stop
$0 start
;;
reload) ##重載服務(wù)
kill -s HUP $(cat $PIDF)
;;
*) ##錯(cuò)誤輸入提示
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0
[root@localhost init.d]# chmod +x /etc/init.d/nginx ##給啟動(dòng)腳本執(zhí)行權(quán)限
[root@localhost init.d]# chkconfig --add nginx ##添加到service管理器中
[root@localhost init.d]# service nginx stop ##就可以使用service控制nginx
[root@localhost init.d]# service nginx start
- 啟用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)聽為所有
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 ##開啟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 ##開啟服務(wù)
Nginx網(wǎng)站服務(wù)——服務(wù)基礎(chǔ),訪問控制(實(shí)戰(zhàn)?。?/a>
本文URL:http://bm7419.com/article42/psdchc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、網(wǎng)站制作、做網(wǎng)站、軟件開發(fā)、企業(yè)建站、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
移動(dòng)網(wǎng)站建設(shè)知識(shí)