当前位置: 首页 Wordpress

TencentOS 安装Nginx的教程

时间:2023年05月31日 阅读:658
以下内容仅是站长或网友个人学习笔记、总结和研究收藏。不保证正确性,因使用而带来的风险与本站无关!
淘客轩-衣食住行外卖生活好助手

TencentOS 安装 git

安装git

yum install git

用户信息配置

git config --global user.name "你的用户名"git config --global user.email "你的邮箱"

配置完成之后
git config --list
会显示你配置的用户名和邮箱信息

git clone https://xxxx

修改文件权限

1. zblog网站的所有文件夹统一设置为755权限;

2. 文件夹中的各个文件的统一设置为644权限。

Nginx 卸载

1:停止Nginx软件
systemctl nginx stop

2:删除Nginx的自动启动
chkconfig nginx off

3:从源头删除Nginx
rm -rf /usr/sbin/nginx
rm -rf /etc/nginx
rm -rf /etc/init.d/nginx

4:再使用yum清理
yum remove nginx

安装Nginx

sudo yum install -y nginx

Nginx 配置

启动Nginx并设置开机自动运行

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

nginx 配置文件 和 启动目录

# 启动目录
/usr/sbin/ 下的 nginx

# 配置文件
/etc/nginx 下 nginx.conf

# 编辑Nginx配置文件
vi /etc/nginx/nginx.conf

#启动nginx服务
systemctl start nginx.service
#停止nginx服务
systemctl stop nginx.service
#重启nginx服务
systemctl restart nginx.service
#重新读取nginx配置(这个最常用, 不用停止nginx服务就能使修改的配置生效)
systemctl reload nginx.service

linux创建www用户组和用户

[root@bogon local]# id www
[root@bogon local]# id: www: no such user
[root@bogon local]# groupadd www
[root@bogon local]# groupadd: group 'www' already exists
//开始添加www用户
[root@bogon local]# useradd -g www -s /sbin/nologin www
//再查看一下
[root@bogon local]# id www
uid=1001(www) gid=1000(www) 组=1000(www)

安装PHP

yum install -y php


开机启动

systemctl enable php-fpm.service


systemctl start php-fpm.service  #启动

systemctl stop php-fpm.service   #停止

service php-fpm start

service php-fpm stop

service php-fpm restart

service php-fpm reload


安装mysql

下载mysql安装包命令: wget +[http://地址]
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
通过yum下载rpm包
yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
yum安装mysql
yum install mysql-community-server
启动MySQL服务器
systemctl start mysqld
MySQL的自动启动
systemctl enable mysqld

#启动命令
systemctl start  mysqld.service
#查看运行状态
systemctl status mysqld.service

安装 mysql-community-server报错

错误1、
报错:
所有的匹配结果均已经被参数的模块化过滤条件筛除: mysql-community-server
错误:没有任何匹配: mysql-community-server
解决办法:
yum module disable mysql
再次执行
[root@localhost ~]# yum install -y mysql-community-server
错误2:
报错:导入公钥成功,导入的密钥没有公钥,错误的公钥? 错误:GPG 检查失败
办法:
[root@localhost ~]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 [root@localhost ~]# yum install -y mysql-community-server

初始化mysql

#1.查询mysql的默认密码 
grep "password" /var/log/mysqld.log

TencentOS 安装Nginx的教程 - MOMO教程

PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client

mysql 安装了最新版本8.0.11后创建用户并授权后,授权的用户连接数据库提示

The server requested authentication method unknown to the client

查阅一些相关的资料后发现是由于新版本的mysql账号密码解锁机制不一致导致的

mysql 8 升级了密码的验证方式 caching_sha2_password, 之前一直是mysql_native_password方式

解决办法:

方法一:

删除创建的用户和授权,

找到mysql配置文件并加入

 default_authentication_plugin=mysql_native_password

变为原来的验证方式,然后从新创建用户并授权即可

方法二:

mysql -uroot -p
 
use mysql;
 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';

然后重启 mysql 即可

zblog 伪静态 nginx

if (-f $request_filename/index.html){
	rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
	rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
	rewrite (.*) /index.php;
}


打赏
标签:

本文地址:https://www.momojc.cn/wordpress/tencentos-.html

相关推荐
支付宝领大额红包
支付宝领大额红包
似水流年
    今日已经过去小时
    这周已经过去
    本月已经过去
    今年已经过去个月
小姐姐视频

关于本站 | 隐私政策 | 免责声明 | 广告合作 | 我要投稿 | 后台管理

CopyRight © 2023-2024 MOMO教程 WWW.MOMOJC.CN , All Rights Reserved.

站长E-mail:378074730@qq.com 网站已运行:  运行时长:0.024 秒

京ICP备20029690号-1京ICP备20029690号-2 京公网安备11011402013892号京公网安备11011402013892号 中国互联网违法和不良信息举报中心 网络违法犯罪举报网站

本网站托管于 腾讯云 .由网站卫士提供网站加速和攻击防御服务 提供CDN加速/防御服务.由zblogcn强力驱动 又拍云提供CDN加速/云存储服务 51la网站统计