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

怎么在百度上做单位网站中国品牌网站官网

怎么在百度上做单位网站,中国品牌网站官网,佛山网站seo哪家好,佛山免费建站平台PQS/TPS 每秒请求数/ 每秒事务数 // 流量衡量参数 可以根据预估QPS 和 服务器的支持的最高QPS 对照计算 就可以得出 需要上架的服务器的最小数量 PV 页面浏览数 UV 独立用户访问量 // 对于网站的总体访问量 response time 响应时间 // 每个请求的响应时间…

PQS/TPS  每秒请求数/ 每秒事务数     // 流量衡量参数

可以根据预估QPS 和 服务器的支持的最高QPS 对照计算 就可以得出 需要上架的服务器的最小数量

PV 页面浏览数    UV 独立用户访问量     // 对于网站的总体访问量

response time   响应时间      // 每个请求的响应时间     

lnmp 分离部署 分化压力

nginx - 一个节点  192.168.110.133

php 一个节点 192.168.110.138

db 一个节点 192.168.110.22

实验topo

实验过程

nginx节点:

[root@nginx ~]# dnf  -y install nginx 
[root@nginx ~]# systemctl enable nginx.service 
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
[root@nginx ~]# systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)Active: active (running) since Tue 2024-09-10 09:12:37 CST; 2h 34min agoDocs: man:firewalld(1)Main PID: 924 (firewalld)Tasks: 2 (limit: 24434)Memory: 42.1MCPU: 1.275sCGroup: /system.slice/firewalld.service└─924 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopidSep 10 09:12:36 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Sep 10 09:12:37 localhost systemd[1]: Started firewalld - dynamic firewall daemon.
[root@nginx ~]# systemctl stop firewalld.service 
[root@nginx ~]# setenforce 0
[root@nginx ~]# vim /etc/exports 
/usr/share/nginx/html *(rw)
[root@nginx ~]# cat /usr/share/nginx/html/index.php 
<?php
phpinfo();
?>
[root@nginx ~]# yum -y install nfs-utils
[root@nginx ~]# systemctl start nfs-server

php:

php:
[root@php ~]# dnf -y install php php-fpm 
[root@php ~]# systemctl stop firewalld.service 
[root@php ~]# setenforce 0
[root@php ~]# systemctl start php-fpm 
[root@php ~]# dnf -y install nfs-utils
root@php ~]# showmount -e 192.168.110.133
Export list for 192.168.110.133:
/usr/share/nginx/html *
[root@php ~]# mkdir -p /usr/local/nginx/html
[root@php ~]# chown apache -R /usr/share/nginx
[root@php ~]# mount 192.168.110.133:/usr/share/nginx/html /usr/share/nginx/html/
[root@php ~]# vim /etc/php-fpm.d/www.conf

// 修改php-fpm 监听本地与nginx同一网段的IPv4地址和9000端口

// 如果只写9000 代表监听所有地址的9000端口

// 允许访问的地址列表中添加nginx的ip地址

[root@php ~]# systemctl start php-fpm.service

返回nginx节点,进行动静分离的配置:

[root@nginx ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@nginx ~]# systemctl reload nginx.service 验证nginx转发php脚本给php-fpm 节点解析
[root@nginx ~]# curl -I 127.0.0.1/index.php
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Tue, 10 Sep 2024 05:49:32 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/8.0.30

如果访问出现问题,结合日志进行排错。

nginx 访问日志: /var/log/nginx/access.log

错误日志:/var/log/nginx/error.log

php-fpm  日志: /var/log/php-fpm/error.log

配置php连接数据库

[root@db-mariadb ~]# dnf -y install mariadb mariadb-server
[root@db-mariadb ~]# systemctl stop firewalld.service 
[root@db-mariadb ~]# setenforce 0
[root@db-mariadb ~]# systemctl start mariadb.service 
[root@db-mariadb ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.22-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> set password=password('redhat');
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]> exit
Bye
[root@db-mariadb ~]# ss -anput | grep mysql
[root@db-mariadb ~]# ss -anput | grep mariadb
tcp   LISTEN 0      80                  *:3306                *:*     users:(("mariadbd",pid=35118,fd=19))                 
[root@db-mariadb ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.5.22-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> select user,host from mysql.user;
+-------------+-----------+
| User        | Host      |
+-------------+-----------+
| mariadb.sys | localhost |
| mysql       | localhost |
| root        | localhost |
+-------------+-----------+
3 rows in set (0.002 sec)MariaDB [(none)]> grant all on *.* to root@192.168.110.138 identified by 'redhat';
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]> select user,host from mysql.user;
+-------------+-----------------+
| User        | Host            |
+-------------+-----------------+
| root        | 192.168.110.138 |
| mariadb.sys | localhost       |
| mysql       | localhost       |
| root        | localhost       |
+-------------+-----------------+
4 rows in set (0.001 sec)MariaDB [(none)]> 

在php上安装php-mysqlnd 模块,并验证可以连接数据库

[root@php ~]# dnf -y install mariadb
[root@php ~]# mysql -h 192.168.110.22 -u root -predhat
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.5.22-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> exit
Bye
[root@php ~]# dnf -y install php-mysqlnd

 切换到nginx 节点上,添加php连接数据库的脚本程序文件

[root@nginx ~]# cat /usr/share/nginx/html/db.php 
<?php
//创建连接
$servername = "192.168.110.22";
$username = "root";
$passwd = "redhat";//检测连接
$conn = mysqli_connect($servername,$username,$passwd);if(!$conn){die("connection failed:" . mysqli_connect_errno());
}else{echo "成功连接数据库";mysqli_close($conn);
}
?>

在php节点查看文件是否同步,已经能否运行该脚本程序

[root@php ~]# ls /usr/share/nginx/html/db.php 
/usr/share/nginx/html/db.php
[root@php ~]# php /usr/share/nginx/html/db.php 
成功连接数据库

通过浏览器验证访问

[root@nginx ~]# curl 192.168.110.133/db.php
成功连接数据库

如果是lnamp 一般采用为apache 服务器前设置代理服务实现动静分离,apache 主要处理动态请求。

在对nginx 、 php 还有数据库 进行水平扩展时,应该怎么做?

http://www.yayakq.cn/news/408537/

相关文章:

  • 湛江网站建设模板定位工厂wordpress 5.3
  • 搬瓦工服务器用来做网站建立自己的网站平台的好处
  • 济南 网站推广chinadaily 世界人口达到80亿
  • 站长工具 seo查询网站背景怎么做
  • 北京顺义有网站建设公司吗动漫设计与制作培训
  • 聊城哪里做网站wordpress去水印插件
  • 拟一份饰品网站建设合同机械公司简介模板
  • 福泉市建设局网站什么公司需要建立网站吗
  • 做布料的著名网站小语种外贸建站
  • 购物网站大全排名调查新媒体包不包括公司网站的建设
  • 苏州好的网站公司哪家好设计logo网站 生成器
  • 自己随便玩玩的网站怎么建设网络营销论文目录
  • 枣庄做网站制作第一ppt
  • 建筑官方网站网站推广与优化哪里好
  • 网站建设与维护管理办法佛山专业网站制作
  • 网站开发的外文文献wordpress主题图片修改
  • 商务网站内容建设包括手机哪个网站好
  • 怀化市优化办电话珠海网站seo
  • PHP MySQL 网站开发实例寒亭区住房和城乡建设局网站
  • 镇江手机网站制作网站编辑培训学校
  • 什么叫定制网站新站加快网站收录
  • 15年做哪个网站能致富网站广告怎么做
  • 海洋网站建设公司网站怎么做公司
  • 我有服务器怎么做网站网站换空间多少钱
  • 设计网站案例建设工程用地批准手续在哪个网站
  • 丹东电信网站备案做视频网站视频存放问题
  • 网站策划的最终体现做app_需要先做网站吗
  • 南宁模板建站多少钱wordpress登录界面源码
  • 中山全麦网站建设网站建设 算什么
  • asp网站路径南昌房产网