1.针对yum list 中找不到的软件 采取rpm 安装 或者二进制安装
2.安装软件:
yum -y install nginx
3.可以采取导入软件rpm包再去下载
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
4.安装
yum install -y lrzsz
可以上传下载文件
5.安装解压软件 (解压zsy20201119-13)
unzip yum -y install unzip
unzip zsy20201119-13
6.切换到nginx配置目录下,编辑配置一个新文件名要以conf为结尾
cd /etc/nginx/conf.d
vim s1.conf
server {
listen 88;
server_name localhost;
location / {
root /opt/zsy20201119-13/zsy20201119-13;
index index.html index.htm;
}
}
7.关闭防火墙和高级安全
systemctl stop firewalld
setenforce 0
8.重启nginx
systemctl restart nginx
9.访问IP端口192.168.60.142:88
10.访问页面展示
二,博客安装
1.首先安装php服务
yum -y install wget
yum -y install curl
yum -y install gcc make zlib-devel pcre pcre-devel openssl-devel
yum -y install gcc*
yum install autoconf -y
yum -y install lsof vim
2.导入源
yum install epel-release
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum update
#rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
3.安装yum-utils
yum install yum-utils
4.安装php
yum -y install php74 php74-php-devel
yum install php74-php-gd php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php-mysqlnd -y
5.修改ohp-fpm配置
user = apache
group = apache
改成
user = www
group = www
6.启动php-fpm
创建用户 zhangzhang
启动php-fpm 访问
systemctl restart php74-php-fpm
检查是否启动:
方式一:lsof -i:9000
方式二:systemctl restart php74-php-fpm
查看php 版本
php74 -v
7.启动前面安装的nginx
修改配置
vim /etc/nginx/nginx.conf
user nginx; 改成 user www; 保存并退出
修改服务配置后要重启服务
systemctl restart nginx.service
启动服务
systemctl start nginx.service
停止服务服务
systemctl start nginx.service
8.测试php-fpm连接
创建/opt/zhangzhang 并vim/opt/zhangzhang/test_php.php
vim /opt/www/test_php.php
<?php
phpinfo();
?>
wq!保存并退出
授权:
chown -R zhangzhang.zhangzhang /opt/zhangzhang
vim /etc/nginx/conf.d/s2.conf
server {
listen 91;
server_name localhost;
location / {
root /opt/dir1/wordpress;
index index.php index.html;
}
location ~ \.php$ {
root /opt/dir1/wordpress;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
9.关闭防火墙和高级安全
10.重启nginx访问IP:端口/test_php:2.php (可以访问证明nginx可以连接php-fpm服务)
11. yum 安装 mysql
12.下载博客
tar -xf latest-zh_CN.tar.gz解压到/opt/下
下载
wget https://cn.wordpress.org/wordpress-5.6.2-zh_CN.tar.gz
解压:
tar -xf wordpress-5.6.2-zh_CN.tar.gz
移动到/opt/下
mv wordpress/ /opt/
cd /opt/wordpress/
cp wp-config-sample.php wp-config.php
vim wp-config.php
# 修改
define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
define( 'DB_PASSWORD', 'password_here' );
define( 'DB_HOST', 'localhost' );
改为
define( 'DB_NAME', 'zhangzhang' ); # 数据库的库名
define( 'DB_USER', 'root' ); # 数据库的登录用户名
define( 'DB_PASSWORD', 'Zyyzyy123.321' ); # 数据库的登录的密码
define( 'DB_HOST', '10.31.154.193' );# 数据库的登录的ip
设置权限wordpress权限
chown -R zhangzhang.zhangzhang /opt/wordpress
13.登录连接数据库 (新建数据库)
14.访问页面登录文章来源:https://www.toymoban.com/news/detail-829807.html
文章来源地址https://www.toymoban.com/news/detail-829807.html
到了这里,关于一, nginx增加端口,打开网页访问:ip的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!