您好,登錄后才能下訂單哦!
Nginx (engine x) 是一個高性能的HTTP和反向代理web服務器,同時也提供了IMAP/POP3/SMTP服務。Nginx是由伊戈爾·賽索耶夫為俄羅斯訪問量第二的Rambler.ru站點(俄文:Рамблер)開發的,第一個公開版本0.1.0發布于2004年10月4日。
其將源代碼以類BSD許可證的形式發布,因它的穩定性、豐富的功能集、示例配置文件和低系統資源的消耗而聞名。2011年6月1日,nginx 1.0.4發布。
Nginx是一款輕量級的Web 服務器/反向代理服務器及電子郵件(IMAP/POP3)代理服務器,在BSD-like 協議下發行。其特點是占有內存少,并發能力強,事實上nginx的并發能力在同類型的網頁服務器中表現較好
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx bind -y
vim /etc/named.conf
vim /etc/named.rfc1912.zones
##復制添加一段
zone "accp.com" IN {
type master;
file "accp.com.zone";
allow-update { none; };
};
cd /var/named
cp -p named.localhost accp.con.zone
vim accp.con.zone
vim /etc/nginx/conf.d/default.conf
systemctl stop firewalld.service
setenforce 0
systemctl start named
systemctl start nginx
vim /etc/nginx/conf.d/default.conf
//添加一段
if ($host = 'www.accp.com') {
rewrite ^/(.*)$ http://www.newaccp.com/$1 permanent;
}
//域名重定向:就是當訪問www.wang.com時,將激動跳轉到www.new.wang.com域名。
//permanent:表示永久的意思。
vim /etc/named.rfc1912.zones
//復制之前的accp域名聲明段修改
cd /var/named
cp -p accp.com.zone newaccp.com.zone
systemctl stop nginx
systemctl start nginx
systemctl restart named
vim /etc/nginx/conf.d/default.conf
listen 80;
server_name www.accp.coom;
#charset koi8-r;
access_log /var/log/nginx/www.accp.com-access.log main;
#設置是否合法的IP標志
set $rewrite true;
#判斷是否為合法IP
if ($remote_addr = "192.168.111.146"){
set $rewrite false;
}
#非法IP進行判斷打上標記
if ($rewrite = true){
rewrite (.+) /main.html;
}
#匹配標記進行跳轉站點
location = /main.html {
root /usr/share/nginx/html;
}
systemctl stop nginx
systemctl start nginx
cd /usr/share/nginx/html
vim main.html
<html>
<head>
<meta charset="utf-8">
<title>test網站</title>
</head>
<body>
<h2>網站維護中,請稍等~~~</h2>
</body>
</html>
systemctl restart nginx
vim /etc/nginx/conf.d/default.conf
listen 80;
server_name bbs.accp.coom;
#charset koi8-r;
access_log /var/log/nginx/www.accp.com-access.log;
#添加一段
location /post {
rewrite (.+) http://www.accp.com/bbs$1 permanent;
}
cd /var/named
vim accp.com.zone #把里面的 www 換成 bbs 不然無法解析。
systemctl restart nginx
systemctl restart named
echo "nameserver 192.168.111.145" > /etc/resolv.conf
listen 80;
server_name www.accp.coom;
#charset koi8-r;
access_log /var/log/nginx/www.accp.com-access.log main;
## 添加一段
if ($request_uri ~ ^/100-(100|200)-(\d+).html$) {
rewrite (.*) http://www.accp.com permanent;
}
server_name www.accp.com;
if ($request_uri ~ ^/100-(100|200)-(\d+).html$) {
rewrite (.*) http://www.test.com permanent;
}
123456
cd /var/named
vim accp.com.zone
systemctl restart nginx
systemctl restart named
vim /etc/nginx/conf.d/default.conf
listen 80;
server_name www.accp.coom;
#charset koi8-r;
access_log /var/log/nginx/www.accp.com-access.log main;
## 添加
location ~* /upload/.*\.php$ {
rewrite (.+) http://www.accp.com permanent;
}
systemctl restart nginx
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。