一、LNMP情况搭建
1、centos7.9
- 自行准备linux环境,笔者使用的是centos7.9.2009
- 查看版本命令为:
- cat /etc/redhat-release
- CentOS Linux release 7.9.2009 (Core)
- [root@blog ~]# setenforce 0
- [root@blog ~]# hostnamectl set-hostname blog
- [root@blog ~]# curl -O http://10.24.2.208/Application/wp-lnmp-c7.9.tar.gz
- [root@blog ~]# tar xf wp-lnmp-c7.9.tar.gz
- [root@blog ~]# rm -rf /etc/yum.repos.d/CentOS-*
- [root@blog ~]# cat /etc/yum.repos.d/local.repo
- [wordpress]
- name=wordpress
- baseurl=file:///root/wp-lnmp-c7.9/packages/
- gpgcheck=0
- enabled=1
- [root@blog ~]# yum install -y unzip
复制代码 2、nginx
- [root@blog ~]# yum install -y nginx
- [root@blog ~]# vi /etc/nginx/nginx.conf.default
- location / {
- root html;
- index index.php index.html index.htm;
- }
-
- location ~ \.php$ {
- root html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
- include fastcgi_params;
- }
- [root@blog ~]# vi /etc/nginx/nginx.conf
- server {
- listen 80;
- listen [::]:80;
- server_name _;
- root /usr/share/nginx/html;
-
- # Load configuration files for the default server block.
- include /etc/nginx/default.d/*.conf;
- location / {
- root html;
- index index.php index.html index.htm; #localtion 加入这个解析
- }
- error_page 404 /404.html;
- location = /404.html {
- }
- location ~ \.php$ {
- root html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; #加入php解析
- include fastcgi_params;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- }
- }
复制代码 3、mariadb
- [root@blog ~]# yum install -y mariadb mariadb-server
- [root@blog ~]# systemctl start mariadb
- [root@blog ~]# mysqladmin -uroot password '123456'
- [root@blog ~]# mysql -uroot -p123456 -e "create database wordpress;"
- [root@blog ~]# mysql -uroot -p123456
- MariaDB [(none)]> grant all on *.* to root@'localhost' identified by '123456';
- Query OK, 0 rows affected (0.000 sec)
-
- MariaDB [(none)]> flush privileges;
- Query OK, 0 rows affected (0.001 sec)
复制代码 4、php
- [root@blog ~]# yum install -y php*
- [root@blog ~]# systemctl start php-fpm
复制代码 5、wordpress
- [root@blog ~]# unzip wp-lnmp-c7.9/wordpress-4.7.3-zh_CN.zip
- [root@blog ~]# rm -rf /usr/share/nginx/html/*
- [root@blog ~]# cp -rvf wordpress/* /usr/share/nginx/html/
- [root@blog ~]# systemctl restart nginx php-fpm
- [root@blog ~]# chown nginx:nginx /usr/share/nginx/html/
- [root@blog ~]# chown -R 755 /usr/share/nginx/html/
复制代码
二、LAMP情况搭建
1、centos7.9
- 自行准备linux环境,笔者使用的是centos7.9.2009
- 查看版本命令为:
- cat /etc/redhat-release
- CentOS Linux release 7.9.2009 (Core)
- [root@blog ~]# setenforce 0
- [root@blog ~]# hostnamectl set-hostname blog
- [root@blog ~]# curl -O http://10.24.2.208/Application/wp-lnmp-c7.9.tar.gz
- [root@blog ~]# tar xf wp-lnmp-c7.9.tar.gz
- [root@blog ~]# rm -rf /etc/yum.repos.d/CentOS-*
- [root@blog ~]# cat /etc/yum.repos.d/local.repo
- [wordpress]
- name=wordpress
- baseurl=file:///root/wp-lnmp-c7.9/packages/
- gpgcheck=0
- enabled=1
- [root@blog ~]# yum install -y unzip
复制代码
2、apache
- [root@blog ~]# yum install -y httpd
复制代码
3、mariadb
- [root@blog ~]# yum install -y mariadb mariadb-server
- [root@blog ~]# systemctl start mariadb
- [root@blog ~]# mysqladmin -uroot password '123456'
- [root@blog ~]# mysql -uroot -p123456 -e "create database wordpress;"
- [root@blog ~]# mysql -uroot -p123456
- MariaDB [(none)]> grant all on *.* to root@'localhost' identified by '123456';
- Query OK, 0 rows affected (0.000 sec)
-
- MariaDB [(none)]> flush privileges;
- Query OK, 0 rows affected (0.001 sec)
复制代码
4、php
- [root@blog ~]# yum install -y php*
复制代码
5、wordpress
- [root@blog ~]# unzip wp-lnmp-c7.9/wordpress-4.7.3-zh_CN.zip
- [root@blog ~]# rm -rf /var/www/html/*
- [root@blog ~]# cp -rvf wordpress/* /var/www/html/
- [root@blog ~]# chown apache:apache -R /var/www/html/
- [root@blog ~]# chown 755 -R /var/www/html/
- [root@blog ~]# systemctl start php-fpm httpd
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |