下载nginx
基于官方源进行nginx安装:
第一个历程:系统环境进行调整
yum install -y gcc gcc-c++ autoconf pcre pcre-devel make automake wget httpd-tools vim tree
第二个历程:配置nginx的官方源
vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
第三个历程: 直接下载安装nginx程序
yum install nginx
1、PHP部署安装:
第一个:解决PHP软件冲突
yum remove php-mysql-5.4 php php-fpm php-common
第二个:更新yum源信息,用户安装php程序
准备yum安装软件扩展源信息
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
第三个:直接安装php服务相关软件
yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb
2、数据库下载
yum install mariadb-server mariadb -y
然后
[root@web01 ~]# systemctl start mariadb.service
创建数据库
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| wordpress |
+--------------------+
5 rows in set (0.00 sec)
###创建用户
grant all on wordpress.* to 'wordpress'@'172.16.1.%' identified by '123456';
grant all on wordpress.* to 'wordpress'@'localhost' identified by '123456';
所有权限 wordpress数据库.所有表 '用户名'@'172.登录' 密码是 123456
创建完数据库以后进行测试 能够进入到数据库即创建成功
[root@web01 ~]# mysql -uwordpress -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> Bye
3、更改php重要文件和目录信息
/etc/php-fpm.conf ---php-fpm进程的配置文件
/etc/php-fpm.d ---php-fpm进程加载配置文件的目录
/etc/php-fpm.d/www.conf
user = nginx --- 利用指定用户管理php工作进程 建议配置和nginx服务相同的用户
group = nginx--- 利用指定用户组管理php工作进程
listen = 127.0.0.1:9000 --- 指定php服务运行后, 监听的地址和端口信息
listen.allowed_clients = 127.0.0.1 --- 只允许本地访问php 9000端口服务
WordPress的配置文件
server {
listen 80;
server_name blog.oldboy.com;
access_log /var/log/nginx/access_blog.log main;
root /usr/share/nginx/html/blog;
location / {
index index.php index.html index.htm;
}
location ~* \.(php|php5)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
将源代码扔进linux中进行解压 将所有的文件解压后移动到站点目录中 ,修改站点目录权限
网友评论