做a视频网站有哪些要制作自己的网站需要什么
news/
2025/10/8 17:54:18/
文章来源:
做a视频网站有哪些,要制作自己的网站需要什么,哪些网站可以做ppi,织梦cms和wordpress目录
LNMP部署--nginx
搭建mysql数据库
安装mysql的过程#xff1a;
部署PHP#xff1a;
编辑编辑php的配置文件在哪
wordpress程序安装 LNMP部署--nginx
纯净--联网状态
环境变量中没有nginx
安装形式的选择#xff1a;
yum安装#xff1a;自动下载安装包及…目录
LNMP部署--nginx
搭建mysql数据库
安装mysql的过程
部署PHP
编辑编辑php的配置文件在哪
wordpress程序安装 LNMP部署--nginx
纯净--联网状态
环境变量中没有nginx
安装形式的选择
yum安装自动下载安装包及其依赖自动化安装省时省力
都是默认的安装路径以及版本不容易指定自定制化太低无法扩展第三方新功能
rpm包安装形式需要手动解决依赖关系弃用
源代码编译安装可以自由下载软件版本自定制安装路径第三方功能扩展
步骤稍微复杂但是还是比较简单的
安装nginx前的系统依赖环境检查及其安装
首先你得把阿里源镜像拉下来
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repowget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
安装nginx所需的pcre库让nginx支持url重写的rewrite功能
yum install pcre pcre-devel -y
安装openssl-devel模块nginx需要支持https
yum install openssl openssl-devel -y
安装gcc编译器
yum install gcc -y下载nginx源码包
[rootlocalhost ~]# mkdir /mytools
[rootlocalhost ~]# cd /mytools/
[rootlocalhost mytools]# ls
[rootlocalhost mytools]# wget nginx.org/download/nginx-1.17.10.tar.gz解压缩
[rootlocalhost mytools]# ls
nginx-1.17.10.tar.gz
[rootlocalhost mytools]# tar zxvf nginx-1.17.10.tar.gz 解压缩完之后创建普通的nginx用户用于运行nginx进程降低nginx的系统权限
useradd nginx -u 1111 -s /sbin/nologin -M 如果之前有用户先删掉即可
开始编译安装nginx服务
./configure --usernginx --groupnginx --prefix/mytools/nginx-1.17.10/ --with-http_stub_status_module --with-http_ssl_module
然后我们此时编译完之后会有一个报错信息
怎么办
先把编译的文件删掉
重新解压缩 [rootlocalhost nginx-1.17.10]# ./configure --usernginx --groupnginx --prefix/mytools/nginx-117/ --with-http_stub_status_module --with-http_ssl_module make make install此时就没问题了 配置nginx的环境变量
做一个软链接也就是快捷方式--生产环境常用操作便于运维、开发、测试使用以及nginx以后的升级
[rootlocalhost mytools]# cd nginx-117/
[rootlocalhost nginx-117]# ls
conf html logs sbin
[rootlocalhost nginx-117]# cd ..
[rootlocalhost mytools]# ln -s /mytools/nginx-117/ /mytools/nginx
[rootlocalhost mytools]# ll
总用量 1016
lrwxrwxrwx 1 root root 19 6月 24 00:43 nginx - /mytools/nginx-117/
drwxr-xr-x 6 root root 54 6月 24 00:41 nginx-117
-rw-r--r-- 1 root root 1039541 4月 14 2020 nginx-1.17.10.tar.gz
[rootlocalhost mytools]# 配置nginx的环境变量
使用绝对路径实现nginx的访问
/mytools/nginx-117/sbin/nginx
看结果
搭建mysql数据库
MySQL是一款关系型数据库且把数据保存在不同的二维表且把数据表再放入数据库中管理而不是所有的数据统一放在一个大仓库这样的设计提高MySQL的读写速度。
安装mysql的过程
安装方式yum安装rpm包安装--简单快速无法定制化--新手推荐
还有一种方法就是二进制安装解压缩后直接简单配置即可使用速度较快专业DBA常用
源码编译安装特点是可以定制化安装需求缺点过程较为复杂
创建mysql用户降低程序运行的权限
useradd -s /sbin/nologin mysql
查看mysql用户信息
id mysql下载mysql二进制软件包提前配置好yum源下载wget命令
yum install wget -y---这个地方跳过即可我准备好了包
我提前准备了一个压缩包--我们怎么办直接拖就行了 然后解压缩mysql二进制代码
tar zxvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz 配置软链接--快捷访问mysql ln -s /mytools/mysql-5.7.26-linux-glibc2.12-x86_64 /mytools/mysql 安全性的准备工作卸载可能centos7存在的mariadb存在的依赖关系
我们现在启动mysqlmariadb可能会冲突
rpm -e --nodeps mariadb-libs启动mysql的配置文件
[mysqld]是区段的含义以下的参数对其生效--这是代表对服务端生效的参数
[mysql] 这是代表对客户端生效的参数
vim /etc/my.cnf
[mysqld]
basedir/mytools/mysql/
datadir/mytools/mysql/data
socket/tmp/mysql.sock
server_id1
port3306
log_error/mytools/mysql/data/mysql_err.log[mysql]
socket/tmp/mysql.sock初始化mysql服务端
先卸载系统自带的mariadb依赖--这一个我们刚才已经做了就不展开了
检查mysql的所需的依赖环境是否存在
yum install libaio-devel -y
创建mysql数据文件夹--用于初始化数据且进行权限控制
mkdir -p /mytools/mysql/data
chown -R mysql.mysql /mytools/mysql/ 修改mysql所有的内容更改属主属组为mysql用户初始化mysql数据库
/mytools/mysql/bin/mysqld --initialize-insecure --usermysql --basedir/mytools/mysql/ --datadir/mytools/mysql/data/
相关参数的解释
--usermysql 指定用户
--basedir 指定mysql安装目录
--datadir/mytools/mysql/data 指定数据文件夹
--initialize-insecure 关闭mysql安全策略
--initialize 开启mysql安全模式配置mysql客户端
使用systemctl命令管理数据库
编写mysql启动的脚本定义一个mysqld.servicevim /etc/systemd/system/mysqld.service
[Unit]
DescriptionMySQL server by chaoge
Documentationman:mysqld(8)
Documentationhttp://dev.mysql.com/doc/refman/en/using-systemd.html
Afternetwork.target
Aftersyslog.target
[Install]
WantedBymulti-user.target
[Service]
Usermysql
Groupmysql
ExecStart/mytools/mysql/bin/mysqld --defaults-file/etc/my.cnf
LimitNOFILE5000启动mysqld服务端
由于我们配置了mysql.service脚本直接用命令启动即可
systemctl start mysqld
systemctl status mysqld设置开机自启动
systemctl enable mysqld
检查mysql启动状态
netstat -tunlp | grep mysql
ps -ef | grep mysql | grep -v grep 登录mysql数据库
这个mysql是c/s架构就好比登录qq一样
先启动mysqld服务端然后再用mysql客户端命令登陆即可
如果你电脑之前装过其他的数据库可以用yum直接卸载不会影响到
你的新装的mysql
yum remove mysql -y 即可配置我们安装的mysql的环境变量
/mytools/mysql/bin/ 这是我们安装的二进制的mysql命令目录
当前的path变量
[rootlocalhost bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
写入如下新的变量
[rootlocalhost bin]# vim /etc/profile
PATH$PATH:/mytools/mysql/bin:/mytools/nginx/sbin保存退出之后重新登录会话目录此时都已经进来了
登录mysql数据库简单的使用一下
[rootlocalhost ~]# mysql -uroot -p简单的sql语句 show databases; 查看数据库 create database lyt; 创建数据库 mysql use lyt; 进入lyt数据库 mysql show table; 查看当前库的表 修改数据库的密码
mysqladmin -uroot password 123456
这样我们最后可以测试一下没有问题 部署PHP
检查Nginx和mysql的安装路径保证nginx、mysql都启动了
netstat -tunlp | grep -E nginx|mysql
安装部署PHP程序所需的系统库不要求必须安装而是安装上之后可以扩展php更多功能
yum install gcc gcc-c make zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel \
freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y
发现yum仓库默认缺少一个libiconv-devel软件包我们手动下载
[rootlocalhost ~]# cd /root/
[rootlocalhost ~]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
然后解压缩-编译安装三部曲
[rootlocalhost mytools]# tar zxvf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure --prefix/mytools/libiconv make make install 编译和编译安装 检查上述编译安装的命令是否结束--在执行上一条语句结束后打印$?可以查看上一次的命令是否正确--正确为0
echo $?编译安装php代码
wget http://mirrors.sohu.com/php/php-7.3.5.tar.gz我们老规矩--解压缩
[rootlocalhost mytools]# tar zxvf php-7.3.5.tar.gz
准备编译环境指定安装路径开启额外功能
./configure --prefix/mytools/php7.3.5 \
--enable-mysqlnd \
--with-mysqlimysqlnd \
--with-pdo-mysqlmysqlnd \
--with-iconv-dir/mytools/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-gd \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-usernginx \
--with-fpm-groupnginx \
--enable-ftp \
--enable-opcacheno --prefix 指定php安装路径 --enable-mysqlnd 使用php自带的mysql相关软件包 --with-fpm-usernginx 指定PHP-FPM程序的用户是nginx和nginx服务保持统一 --enable-fpm 激活php-fpm方式以FastCGI形式运行php程序 系统检查完成后我们开始安装就好了然后我们
在执行完编译脚本文件后开始执行编译安装
make make install这个时间稍微会有一点长毕竟编译安装的东西很多用特殊变量验证 echo $?
php的配置文件在哪
默认的ph配置文件模板在解压php源码的目录下
[rootlocalhost php-7.3.5]# ls php.ini*
php.ini-development php.ini-production
development 开发模式 production 生产模式
拷贝该配置文件放入到php的编译安装目录下
我想看看这两个文件到底有什么区别
[rootlocalhost php-7.3.5]# vimdiff php.ini-development php.ini-production
开发环境下开起了更多的日志、调试信息生产环境该参数都关闭了颜色区分开来的都是有区别的
我们拷贝一下
[rootlocalhost php-7.3.5]# cp php.ini-development /mytools/php7.3.5/php.ini有关fastcgi的配置文件
检查fastcgi的默认配置文件
[rootlocalhost php-7.3.5]# cd /mytools/php7.3.5/etc/
[rootlocalhost etc]# ls
pear.conf php-fpm.conf.default php-fpm.d拷贝模板配置文件生成新的配置文件
[rootlocalhost etc]# cp php-fpm.conf.default php-fpm.conf
[rootlocalhost etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d[rootlocalhost etc]# cd php-fpm.d/
[rootlocalhost php-fpm.d]# ls
www.conf.default
[rootlocalhost php-fpm.d]# cp www.conf.default www.conf启动php服务fastcgi模式
用绝对路径启动php进程
[rootlocalhost etc]# cd ..
[rootlocalhost php7.3.5]# ls
bin etc include lib php php.ini sbin var
[rootlocalhost php7.3.5]# cd sbin/
[rootlocalhost sbin]# ls
php-fpm
[rootlocalhost sbin]# pwd
/mytools/php7.3.5/sbin
[rootlocalhost sbin]# /mytools/php7.3.5/sbin
-bash: /mytools/php7.3.5/sbin: 是一个目录
[rootlocalhost sbin]# /mytools/php7.3.5/sbin/php-fpm netstat -tunlp|grep php 修改nginx支持php代码
删除nginx.conf中其他无用的参数然后用include语法对每一个虚拟主机管理
手动创建extra目录以及my_php.conf
我们先修改nginx.conf当中的内容
vim /mytools/nginx/conf/nginx.conf#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;
events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;
include extra/my_php.conf;}
手动创建extra目录以及my_php.conf
[rootlocalhost sbin]# cd /mytools/nginx/conf/
[rootlocalhost conf]# ls
fastcgi.conf fastcgi_params koi-utf mime.types nginx.conf scgi_params uwsgi_params win-utf
fastcgi.conf.default fastcgi_params.default koi-win mime.types.default nginx.conf.default scgi_params.default uwsgi_params.default
[rootlocalhost conf]# mkdir extra
[rootlocalhost conf]# cd extra/
[rootlocalhost extra]# vim my_php.conf写入如下内容
server{
listen 80;
server_name _;
location / {root html;index index.html;
}#添加有关php程序的解析
#判断当请求url结尾是以php,php5的时候就进入到如下的location代码
location ~ .*\.(php|php5)?$ {root html/myphp;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;
}
}
检查nginx语法以及重启nginx nginx -t
nginx -s reload
创建php的首页脚本文件再重启一下
[rootlocalhost extra]# mkdir -p /mytools/nginx/html/myphp
[rootlocalhost extra]# echo ?php phpinfo(); ? /mytools/nginx/html/myphp/index.php测试lnmp的结合关系
nginx -s reloadvim /mytools/nginx/html/myphp/index.php nginx -s reload
lnmp环境搭建好了已经可以处理转发请求php了
测试php访问mysql
编写php脚本代码在网页中解析
[rootlocalhost conf]# cd /mytools/nginx/html/
[rootlocalhost html]# ls
50x.html index.html myphp
[rootlocalhost html]# cd myphp/
[rootlocalhost myphp]# vim text_mysql.php?php
$link_idmysqli_connect(localhost,root,123456) or mysql_error();
if($link_id){echo mysql successful by lytxxx.\n;
}else {echo mysql_error();
}
?
如上脚本的中文解释
1.建立mysql连接把链接信息复制给变量 lind_id
2.如果link_id 为真就打印一串字符串信息告诉你mysql连接成功
3.否则给你输出mysql的报错信息然后自己调试
再次测试连接lnmp环境让nginx转发请求给php然后测试是否能连接mysql
我们开始搭建网站搭建wordpress
环境准备
1.启动mysql数据库创建用于wordpress博客的数据库
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.26 MySQL Community Server (GPL)Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type help; or \h for help. Type \c to clear the current input statement.mysql show databases;
--------------------
| Database |
--------------------
| information_schema |
| lyt |
| mysql |
| performance_schema |
| sys |
--------------------
5 rows in set (0.01 sec)mysql 2.创建wordpress数据库
mysql create database wordpress;3.创建用于wordpress的数据库用户
create user wordpress; 4.给该用户授权
给这个wordpress授权允许在localhost本地登录mysql且有增删改查的权限且设置密码为123456
mysql grant all on wordpress.* to wordpresslocalhost identified by 123456;5.刷新授权表用于生效
mysql flush privileges;
6.查询刚才创建的用户信息
mysql show databases;
mysql use mysql; 进入mysql数据库
mysql show tables;
mysql desc user; 查询表结构
mysql select user,authentication_string,host from mysql.user;查询mysql数据库中的user表中的几个字段的信息
7.确保nginx支持php程序的解析就是我们配置过的这个
[rootlocalhost ~]# cd /mytools/nginx
[rootlocalhost nginx]# cd conf/
[rootlocalhost conf]# cd extra/
[rootlocalhost extra]# ls
my_php.conf
[rootlocalhost extra]# vim my_php.conf server{
listen 80;
server_name _;
location / {root html/myphp;index index.php index.html;
}#添加有关php程序的解析
#判断当请求url结尾是以php,php5的时候就进入到如下的location代码
location ~ .*\.(php|php5)?$ {root html/myphp;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;
}
}保存退出
nginx -t
nginx -s reload
wordpress程序安装
1.获取网站程序代码
wget https://wordpress.org/latest.zip
wget https://wordpress.org/latest.tar.gz
2.解压缩网站程序代码
yum -y install unzip.
[rootlocalhost mytools]# unzip latest.zip 直接把解压出来的网站代码移动到nginx目录下
[rootlocalhost mytools]# mv wordpress/ /mytools/nginx/html/myphp/
[rootlocalhost mytools]# cd /mytools/nginx/html/myphp/移动网站程序到当前目录来
[rootlocalhost myphp]# ls wordpress/
index.php wp-blog-header.php wp-includes wp-settings.php
license.txt wp-comments-post.php wp-links-opml.php wp-signup.php
readme.html wp-config-sample.php wp-load.php wp-trackback.php
wp-activate.php wp-content wp-login.php xmlrpc.php
wp-admin wp-cron.php wp-mail.php
[rootlocalhost myphp]# ls
index.php text_mysql.php wordpress
[rootlocalhost myphp]# rm -rf index.php text_mysql.php
[rootlocalhost myphp]# ls
wordpress
[rootlocalhost myphp]# mv wordpress/* ./修改网站程序属主属组信息
[rootlocalhost myphp]# chown -R nginx.nginx ./*重启
nginx -s reload
这个地方出现问题是因为
我们这里面少了一个文件叫wp-config.php
既然少了我就往里面写点东西
[rootlocalhost conf]# cd /mytools/nginx/html/myphp/
[rootlocalhost myphp]# vim wp-config.php这个文件写啥
?phpdefine(DB_NAME, wordpress);
define(DB_USER, wordpress);
define(DB_PASSWORD, 123456);
define(DB_HOST, localhost);define(AUTH_KEY, put your unique phrase here);
define(SECURE_AUTH_KEY, put your unique phrase here);
define(LOGGED_IN_KEY, put your unique phrase here);
define(NONCE_KEY, put your unique phrase here);
define(AUTH_SALT, put your unique phrase here);
define(SECURE_AUTH_SALT, put your unique phrase here);
define(LOGGED_IN_SALT, put your unique phrase here);
define(NONCE_SALT, put your unique phrase here);
$table_prefix wp_;define(WP_DEBUG, false);if ( !defined(ABSPATH) )define(ABSPATH, dirname(__FILE__) . /);require_once( ABSPATH . wp-settings.php );?nginx -s reload
即可
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/931781.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!