求网站建设详细过程站长之家0

张小明 2026/1/10 3:22:54
求网站建设详细过程,站长之家0,免费空间领取网站,php抽奖网站源码文章目录基于动态页面的web架构1、为什么需要LNMP架构2、LNMP、LNMT3、简单安装LNMP架构3.1、部署nginx服务3.2、安装php1、使用第三方扩展 epel 源安装 php7.12、安装扩展源#xff08;epel-release-7、webtatic-release#xff09;3、配置第三方源#xff0c;使用 Remi 仓…文章目录基于动态页面的web架构1、为什么需要LNMP架构2、LNMP、LNMT3、简单安装LNMP架构3.1、部署nginx服务3.2、安装php1、使用第三方扩展 epel 源安装 php7.12、安装扩展源epel-release-7、webtatic-release3、配置第三方源使用 Remi 仓库4、安装php7.1版本5 、替换php-fpm运行的用户和组启动服务3.3、部署mysql 5.7.363.2.1、安装mysql1、使用仓库进行安装、启动服务卸载所有mysql-community相关包导入MySQL 5.7/8.0通用的最新GPG密钥2022版可选若上述密钥仍不匹配导入MySQL 5.7专属的旧密钥重新安装mysql-community-server会自动安装依赖包2、修改密码3.4、验证LNMP架构是否部署成功1、编写Nginx的配置文件连接PHP2、创建站点目录文件、完成授权3、完成主机映射可以通过域名访问**验证一通过Nginx是否可以正常访问PHP资源****验证二PHP是否正常连接数据库**基于动态页面的web架构1、为什么需要LNMP架构因为nginx模块少轻量级只能解析静态的网页为了解决nginx访问动态网页的问题需要通过架构去解决2、LNMP、LNMTLlinux系统的平台也可以是wN前端web服务 Nginx 也可以是A ApacheM后端数据库 mysqlP语言 用于连接前端和后端的角色 PHP Perl PythonLlinux系统的平台也可以是wN负载均衡 代理M后端数据库 mysqlTTomcat Java中间件web服务3、简单安装LNMP架构3.1、部署nginx服务yum安装 nginx1.14 php7.1 mysql5.71、使用官方yum源进行安装Nginx[rootweb01 yum.repos.d]# cat nginx.repo[nginx]namenginx repobaseurlhttp://nginx.org/packages/centos/7/$basearch/gpgcheck0enabled1[rootweb01 ~]# yum -y install nginx2、创建程序用户[rootweb01 ~]# groupadd www -g 666[rootweb01 ~]# useradd www -u 666 -g 666 -s /sbin/nologin -M3、修改配置文件[rootweb01 nginx]# sed -i /^user/c user www; /etc/nginx/nginx.conf[rootweb01 nginx]# cat /etc/nginx/nginx.conf |head -10user www;worker_processes auto;error_log /var/log/nginx/error.log notice;pid /var/run/nginx.pid;events{worker_connections1024;4、启动并且自启动[rootweb01 nginx]# systemctl start nginx[rootweb01 nginx]# systemctl enable nginx3.2、安装php1、使用第三方扩展 epel 源安装 php7.11、使用第三方扩展 epel 源安装 php7.1#1.移除旧版php[rootweb01 nginx]# yum remove php-mysql-5.4 php php-fpm php-common -y2、安装扩展源epel-release-7、webtatic-release# 下载epel-release-7-14.noarch.rpm归档版本稳定可用wgethttps://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm# 安装该rpm包rpm-Uvh epel-release-7-14.noarch.rpm 注意webtatic 仓库已经停止维护对 CentOS7的支持也已终止建议尽量避免使用rpm-Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm3、配置第三方源使用 Remi 仓库安装Remi-release-7rpm-Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm 安装yum-utils提供yum-config-manager工具 yuminstall-y yum-utils 启用Remi的PHP7.4仓库根据需要替换为5.6/7.2/8.0等 yum-config-manager --enable remi-php74 清理缓存[rootweb01 nginx]# yum clean all[rootweb01 nginx]# yum makecache4、安装php7.1版本[rootweb01 nginx]# yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb5 、替换php-fpm运行的用户和组启动服务[rootweb01 php-fpm.d]# sed -i /^user/c user www /etc/php-fpm.d/www.conf[rootweb01 php-fpm.d]# sed -i /^group/c group www /etc/php-fpm.d/www.conf[rootweb01 php-fpm.d]# systemctl start php-fpm[rootweb01 php-fpm.d]# systemctl enable php-fpmCreated symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.3.3、部署mysql 5.7.36动态网站根据用户输入的信息在后端数据库中进行查询之后组合的一个页面静态网站固定的页面所见即所得现在的网页大部分都是动静结合一般网页的首页都是静态的动态数据用户的信息 网页的内容一般存放在数据库中静态数据固定的文件图片、音频、视频、文本一般存放在磁盘中一般以5.6为分割5.6已经稳定了但是安全性还是不太好5.7之后已经完善了3.2.1、安装mysql1、使用仓库进行安装、启动服务1、安装Mysql5.7# 下载并安装MySQL社区版仓库包适用于EL7/CentOS7[rootweb01 ~]# rpm -ivh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm默认情况下上述仓库包会启用 MySQL8.0仓库禁用5.7仓库因此需要手动调整# 安装yum-utils提供yum-config-manager工具若已安装可跳过[rootweb01 ~]# yum install -y yum-utils# 禁用MySQL 8.0仓库[rootweb01 ~]# yum-config-manager --disable mysql80-community# 启用MySQL 5.7仓库[rootweb01 ~]# yum-config-manager --enable mysql57-community# 安装MySQL 5.7社区版服务器[rootweb01 ~]# yum install -y mysql-community-server[rootweb01 ~]# systemctl start mysqld[rootweb01 ~]# systemctl enable mysqld安装过程中如果报错key失败可以操作以下命令卸载所有mysql-community相关包yum remove -y mysql-community-*导入MySQL 5.7/8.0通用的最新GPG密钥2022版rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022可选若上述密钥仍不匹配导入MySQL 5.7专属的旧密钥rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql57重新安装mysql-community-server会自动安装依赖包yum install -y mysql-community-server2、修改密码修改密码[rootweb01 ~]# grep temporary password /var/log/mysqld.log2025-12-17T02:02:36.996806Z1[Note]A temporary password is generatedforrootlocalhost:#Elkj2gp0efb[rootweb01 ~]# mysql -uroot -p$(awk /temporary password/{print $NF} /var/log/mysqld.log)mysql:[Warning]Using a password on thecommandline interface can be insecure. Welcome to the MySQL monitor. Commands end with;or\g. Your MySQL connectionidis3Server version:5.7.44 Copyright(c)2000,2023, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. mysqlALTERUSERrootlocalhostIDENTIFIED BYJy123.com;Query OK,0rows affected(0.01sec)3.4、验证LNMP架构是否部署成功1、Nginx 是否能正常解析 php 动态请求2、php 程序能否正常连接数据库1、编写Nginx的配置文件连接PHP[rootweb01 ~]# cat /etc/nginx/conf.d/www.confserver{server_name www.jy.com;root /code/www;index index.php index.html;client_max_body_size 20M;location ~\.php${# 定义php页面的路径如果跟默认的root一样可以不写root /code/www;# 定义php-fpm的访问方式fastcgi_pass127.0.0.1:9000;# 定义php的索引文件名跟站点默认index要匹配fastcgi_index index.php;# 定义fastcgi的解析路径fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;include fastcgi_params;}}#注释如果我们将root定义在location里面那么每一个location里面都需要写路径2、创建站点目录文件、完成授权[rootweb01 ~]# mkdir -p /code/www[rootweb01 ~]# echo ?php phpinfo(); ? /code/www/index.php[rootweb01 ~]# echo Hello World /code/www/index.html授权 更改目录的所有者为nginx或设置通用权限[rootweb01 ~]# chown -R www.www /code/www# 设置目录和文件的权限目录755文件644安全且满足访问需求[rootweb01 ~]# chmod -R 755 /code/www[rootweb01 ~]# chmod 644 /code/www/index.php /code/www/index.html# 重新设置SELinux上下文递归应用到/code/wwwchcon -R -t httpd_sys_content_t /code/www# 可选永久生效避免重启后失效semanage fcontext -a -t httpd_sys_content_t/code/www(/.*)?restorecon -R /code/www3、完成主机映射可以通过域名访问物理主机映射文件 C:\Windows\System32\drivers\etc验证一通过Nginx是否可以正常访问PHP资源验证二PHP是否正常连接数据库编写配置文件[rootweb01 ~]# cat /code/www/mysqli.php?php$servernamelocalhost;$usernameroot;$passwordTf123.com;// 创建连接$connmysqli_connect($servername,$username,$password);// 检测连接if(!$conn){die(Connection failed: .mysqli_connect_error());}echo连接成功;?
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

快速生成网站网站域名怎么取

Windows 10开始屏幕与应用使用全指南 1. 认识Windows 10开始屏幕与应用 在Windows 10系统中,点击屏幕左下角的“开始”按钮或者按下特定按键,就会弹出开始屏幕。这个开始屏幕堪称Windows 10操作的核心枢纽,几乎能让你触及系统的方方面面。 开始屏幕里汇聚了众多程序,也就…

张小明 2025/12/27 7:50:05 网站建设

成都快速建站模板低多边形生成网站

构建高可用性集群解决方案的硬件规划指南 在构建高可用性集群解决方案时,前期的设计和规划至关重要。这不仅涉及到硬件的选择和配置,还需要考虑资源分配、预算规划以及各种潜在的问题。以下将详细介绍构建集群解决方案时需要考虑的各个方面。 1. 设计阶段的重要性 集群设计…

张小明 2025/12/28 9:19:25 网站建设

网站建设推广服务seo营销网站

01 BPE Tokenizer 自底向上合并字节的分词器(Byte-Pair Encoding)。 通过不断合并高频字节对,逐步形成稳定的子词单元。 02 FLOPs 计算与显存估算 计算量估算:矩阵乘法中,平均每个参数大约需要 2 FLOPs/token。 例如&a…

张小明 2025/12/27 7:50:01 网站建设

cms建站系统介绍运营培训

Python剪贴板操作终极指南:5分钟掌握Pyperclip核心功能 【免费下载链接】pyperclip Python module for cross-platform clipboard functions. 项目地址: https://gitcode.com/gh_mirrors/py/pyperclip 还在为程序间的数据传递而烦恼吗?想要实现一…

张小明 2026/1/10 18:23:49 网站建设

网站的经典推广方法吉县网站建设

VSCode插件助力Stable Diffusion 3.5 FP8开发:高效调试新体验 在生成式AI快速渗透创意与工业领域的今天,一个现实问题日益凸显:我们拥有了越来越强大的文生图模型,却依然在“调不动、跑不起、改不了”的困境中挣扎。尤其是在消费级…

张小明 2025/12/27 7:49:57 网站建设

网站建设的研究目标做网站需要留什么

你是不是也遇到过这样的困扰:IDM试用期刚过,就开始弹出烦人的注册提醒,或者更糟糕的是,突然显示"假序列号"的错误提示?别担心,今天我们就来分享一个神奇的解决方案,让你彻底告别这些烦…

张小明 2025/12/27 7:49:55 网站建设