LNMP,以下配置在离线情况下,使用下载的nginx包,cdrom光盘,php
源码安装nginx
前提:关闭防火墙,selinux,搭建本地yum源安装依赖包
setenforce 0
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload
firewall-cmd --list-all
本地yum源
rm -f /etc/yum.repos.d/*
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
vi /etc/yum.repos.d/cdrom.repo
写以下内容
[cdrom]
name=cdrom
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
18 yum makecache
yum install vim wget bash-completion
yum install -y make gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel unzip zip gd gd-devel cyrus-sasl-md5
###3上传nginx
useradd nginx
tar -zxvf nginx…
cd nginx…
./configure
–user=nginx
–group=nginx
–prefix=/etc/nginx
–sbin-path=/usr/sbin/nginx
–conf-path=/etc/nginx//conf/nginx.conf
–pid-path=/var/run/nginx.pid
–lock-path=/var/run/nginx.lock
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–with-http_gzip_static_module
–with-http_stub_status_module
–with-http_ssl_module
–with-pcre
–with-file-aio
–with-http_realip_module \
make && make install
验证:
nginx
#安装php依赖
上传php php-fpm
56 tar -zxvf php74.tar.gz
57 ls
58 cd php74
59 ls
60 yum localinstall *.rpm
修改nginx配置文件 支持php
取消关于解析php的注释:
65 location ~ .php$ {
66 root html;
67 fastcgi_pass 127.0.0.1:9000;
68 fastcgi_index index.php;
69 fastcgi_param SCRIPT_FILENAME
d
o
c
u
m
e
n
t
r
o
o
t
document_root
documentrootfastcgi_script_name;
#上面一行注意修改
70 include fastcgi_params;
71 }
cd /etc/nginx/html
vim index.php #创建一个php查询网页
~
重启nginx -s reload
systemctl restart php-fpm
====离线安装mysql5.7
上传php
安装依赖
yum install net-tools
卸载mariadb
yum remove mariadb*
上传mysql,解压
tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C ./mysql57/
cd mysql57
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
&& rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
&& rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm &&
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
systemctl start mysqld #启动mysql
grep password /var/log/mysqld.log #查看初始密码
mysql_secure_installation :修改初始密码
或者进入到mysql模式
mysql -uroot -p"上面查询到密码"
修改root密码
alter user root@localhost identified by “新密码”;
这是我的是 Root@123456
exit
=====上传wordpress
建立wordpress数据库
mysql模式
create database 数据库名;
create database wordpress;
建立数据库管理 用户,
create user “wdps_user”@localhost identified by “Root@123456”;
给上面用户管理 管理 相应数据库权限
grant all privileges on wordpress.* to “wdps_user”@localhost with grant option;
刷新,生效
flush privileges;
exit
传wordpress 解压
tar -zxvf wordpress…
cp -rf wordpress/* /etc/nginx/html
cd /etc/nginx/html/
vim wp-config.php,
添写数据库、用户名等,并写入上面的文件 安装