当前位置: 首页 > wzjs >正文

网站留住访客百度禁止seo推广

网站留住访客,百度禁止seo推广,如何做php分页网站,苏州餐饮 网站建设一、环境准备与依赖安装 1. 关闭防火墙和SELinux(仅限测试环境) systemctl stop firewalld # 停止防火墙 systemctl disable firewalld # 禁用防火墙开机启动 setenforce 0 # 临时关闭SELinux 2. 安装编译依赖 yum -y insta…

一、环境准备与依赖安装

1. 关闭防火墙和SELinux(仅限测试环境)

systemctl stop firewalld      # 停止防火墙
systemctl disable firewalld   # 禁用防火墙开机启动
setenforce 0                  # 临时关闭SELinux

2. 安装编译依赖

yum -y install gcc pcre-devel zlib-devel

3. 下载并解压Nginx源码

wget https://nginx.org/download/nginx-1.27.5.tar.gz
tar -zxvf nginx-1.27.5.tar.gz
cd nginx-1.27.5/

二、编译安装Nginx

1. 配置编译选项

./configure --prefix=/usr/local/nginx

2. 编译并安装

make -j4        # 使用4核并行编译加速
make install

三、Nginx服务管理

1. 创建systemd服务文件

vim /etc/systemd/system/nginx.service

2. 添加以下内容:

[Unit]
Description=nginx server
After=network.target[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true[Install]
WantedBy=multi-user.target

3. 重新加载systemd配置

systemctl daemon-reload

4. 常用命令

命令描述
systemctl start nginx启动Nginx服务
systemctl stop nginx停止Nginx服务
systemctl restart nginx重启Nginx服务
systemctl status nginx查看服务状态
nginx -s reload重载配置文件
nginx -t测试配置文件语法

四、验证安装与端口检查

1. 验证端口监听

# 方法1:使用netstat
netstat -ntlp | grep nginx# 方法2:使用lsof
lsof -i :80# 方法3:使用ss
ss -tunlp | grep :80

2. 访问测试

浏览器访问服务器IP地址,应看到Nginx欢迎页面


五、负载均衡配置实战

1. 配置上游服务器组

编辑Nginx配置文件:

vim /usr/local/nginx/conf/nginx.conf

2. 在http块中添加负载均衡配置

upstream tomcatCluster {server localhost:8080 weight=2;  # 权重2server localhost:8081 weight=2;  # 权重2server localhost:8082 weight=6;  # 权重6
}

3. 配置反向代理规则

server {listen  80;server_name  localhost;# 静态资源服务location / {root   /usr/local/nginx/html/;index  index.html index.htm;}# API请求代理location ~^/api/ {rewrite ^/api/(.*)$ /$1 break;  # URL重写proxy_pass  http://tomcatCluster;  # 转发到服务器组proxy_redirect default;# 可选:添加代理头信息proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;}
}

4. 重启Nginx使配置生效

systemctl restart nginx

六、后端服务器准备(Tomcat示例)

1. 创建多个Tomcat实例

cd /usr/local/tomcat
cp -r t1 t2  # 复制实例
cp -r t1 t3  # 复制实例

2. 修改各实例端口

# 编辑server.xml修改以下端口
vim t1/conf/server.xml  # 修改8005, 8080, 8009
vim t2/conf/server.xml  # 修改8006, 8081, 8010
vim t3/conf/server.xml  # 修改8007, 8082, 8011

3. 创建区分页面

# 在t1实例中:
echo '<h1 style="color:red">T1 Instance</h1>' > t1/webapps/ROOT/index.jsp# 在t2实例中:
echo '<h1 style="color:blue">T2 Instance</h1>' > t2/webapps/ROOT/index.jsp# 在t3实例中:
echo '<h1 style="color:green">T3 Instance</h1>' > t3/webapps/ROOT/index.jsp

七、验证负载均衡效果

  1. 启动所有Tomcat实例

  2. 访问 http://your-server-ip/api/

  3. 多次刷新页面,观察不同Tomcat实例的响应

  4. 查看响应头中的 X-Backend-Server 确认请求分发情况


性能优化建议

# 在http块中添加以下优化参数
http {# 连接优化keepalive_timeout  65;keepalive_requests 1000;# 缓冲优化client_body_buffer_size 10K;client_header_buffer_size 1k;client_max_body_size 8m;large_client_header_buffers 4 4k;# 超时设置client_body_timeout 12;client_header_timeout 12;send_timeout 10;# 开启Gzip压缩gzip on;gzip_types text/plain text/css application/json;
}

生产环境注意事项

  1. 保持防火墙开启状态,仅开放必要端口

  2. 配置SELinux策略而非完全禁用

  3. 定期更新Nginx版本修复安全漏洞

  4. 使用非root用户运行Nginx进程

​​​

http://www.dtcms.com/wzjs/208322.html

相关文章:

  • 驾校网站模板云seo关键词排名优化软件
  • 天猫网站做的比京东好潍坊网站收录
  • 建设网站需要学习什么东莞做网站推广公司
  • txt怎么做pdf电子书下载网站温州网站建设制作
  • 计算机学校全国排名百度seo优化是什么
  • 河南省建设银行网站年报做优化关键词
  • 做网站的域名怎么申请大地资源网在线观看免费
  • 网站内页seo查询提升seo排名平台
  • uc下一页广州排前三的seo公司
  • 网上做任务网站有哪些内容青岛疫情最新情况
  • 什么网站可以做医疗设备的百度推广登录入口电脑
  • 有什么网站可以发布个人信息百度竞价软件哪个好
  • 网站建设优化及推广在线科技成都网站推广公司
  • 网站建设人员工作要求网站关键词优化软件效果
  • 网站制作文章北京seo产品
  • 张家港建网站价格哈尔滨百度网站快速优化
  • 网络服务类型及其采用的网络协议有哪些seo专业知识培训
  • 网站信息推广的策略有哪些网站推广软件哪个最好
  • wordpress建站怎么样惠州网站排名提升
  • 揭阳网站建设东莞网站建设优化
  • 扬州有什么做网站的公司佛山网站优化排名推广
  • wordpress阅读量随机生成优化百度百科
  • 深圳品牌营销策划机构网络优化工作应该怎么做
  • 做网站商丘广告服务平台
  • 北京王府井步行街官网seo关键词排名系统
  • 怎样用腾讯云做网站外贸网络推广服务
  • 做仿网站公司seo外链网
  • 做杀人任务的网站seo网站排名优化工具
  • 华泰保险公司官方网站seo诊断优化专家
  • wordpress局域网无法访问seo下拉优化