1. cat /etc/yum.repos.d/local.repo //配置yum
    2. [centos]
    3. name=centos
    4. baseurl=file:///opt/centos
    5. gpgcheck=0
    6. enabled=1
    7. [lnmp]
    8. name=lnmp
    9. baseurl=file:///root/project3/lnmp
    10. gpgcheck=0
    11. enabled=1
    12. yum -y install nginx mariadb-server mariadb php-fpm php-mysql
    13. systemctl start nginx && systemctl enable nginx
    14. vi /etc/nginx/conf.d/default.conf
    15. location / {
    16. root /usr/share/nginx/html;
    17. index index.php index.html index.htm;
    18. }
    19. location ~ \.php$ {
    20. root /usr/share/nginx/html;
    21. fastcgi_pass 127.0.0.1:9000;
    22. fastcgi_index index.php;
    23. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    24. include fastcgi_params;
    25. }
    26. systemctl restart nginx
    27. systemctl start mariadb && systemctl enable mariadb //启动数据库
    28. mysql_secure_installation //初始化数据库
    29. mysql -uroot -p123456 //登录数据库
    30. > create database wordpress; //创建数据库服务
    31. > grant all privileges on *.* to root@localhost identified by '123456' with grant option; //授权所有用户拥有本地数据库的所有权限。
    32. > grant all privileges on *.* to root@"%" identified by '123456' with grant option; //授权用户可进行远程登录
    33. vi /etc/php-fpm.d/www.conf
    34. systemctl start php-fpm && systemctl enable php-fpm
    35. user = nginx
    36. ; RPM: Keep a group allowed to write in log dir.
    37. group = nginx
    38. unzip wordpress-4.7.3-zh_CN.zip
    39. cd /usr/share/nginx/html
    40. rm -rf *
    41. cp -rvf /root/wordpress/* ./
    42. cp wp-config-sample.php wp-config.php
    43. chmod 777 *
    44. vi wp-config.php
    45. // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
    46. /** WordPress数据库的名称 */
    47. define('DB_NAME', 'wordpress');
    48. 使用Curl命令,返回前端页面
    49. /** MySQL数据库用户名 */
    50. define('DB_USER', 'root');
    51. /** MySQL数据库密码 */
    52. define('DB_PASSWORD', '123456');
    53. /** MySQL主机 */
    54. define('DB_HOST', '127.0.0.1');
    55. /** 创建数据表时默认的文字编码 */
    56. define('DB_CHARSET', 'utf8');
    57. /** 数据库整理类型。如不确定请勿更改 */
    58. define('DB_COLLATE', '');