本帖最后由 年轻的虚无主义者 于 2023-6-28 09:05 编辑
什么是LNMP? Linux+Nginx+MySQL+PHP 安装数据库: [root@compute ~]# yum install -y mariadb-server mariadb [root@compute ~]# systemctl enable mariadb && systemctl start mariadb [root@compute ~]#mysql_secure_installation Enter current password for root (enter for none):直接回车 Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y [root@compute ~]#mysql -uroot -p000000 MariaDB[(none)]>grant all privileges on *.* to root@'%' identified by'password'; 授权远程登陆 MariaDB [(none)]>flush privileges; 刷新一下 安装PHP7: [root@compute ~]#yum install-y php72* --skip-broken 直接安装所有php,--skip-broken解决依赖出现的问题。 [root@compute ~]#systemctl restart php-fpm [root@compute ~]#systemctl enable php-fpm #启动php 安装nginx: [root@compute ~]#./configure 查看后需要安装yum install -y zlib zlib-devel [root@compute ~]#make 编译 [root@compute ~]#makeinstall 安装,目录在/usr/local/nginx [root@compute~]#cd /usr/local/nginx/sbin #html为网站源码的根目录,sbin为脚本启动 [root@compute ~]#./nginx #启动nginx [root@compute ~]#cd /usr/local/nginx/conf [root@compute ~]#vi nginx.conf
安装Wordpress: [root@compute~]#unzip latest.zip #解压 [root@compute~]#cd /usr/local/nginx/html [root@compute~]#mkdir 1 [root@compute~]#mv ./* 1 [root@compute~]#mv /root/wordpress/* /usr/local/nginx/html 创建数据库: [root@compute~]#mysql -uroot -p000000 MariaDB[(none)]>create database wordpress; 连接数据库: [root@compute~]#cp wp-config-sample.php wp-config.php 并修改一下内容
|