十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
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
test网站
网站维护中,请稍等~~~
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