系统环境版本php
[root@db02 ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@db02 ~]# uname -a Linux db02 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21 19:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
下载解压mysql软件html
wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
useradd -s /sbin/nologin -M mysql
mv mysql-5.6.34-linux-glibc2.5-x86_64/ /application/mysql-5.6.34 ln -s /application/mysql-5.6.34/ /application/mysql
chown -R mysql.mysql /application/mysql/data/
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
--basedir --- 指定mysql的程序目录
--datadir --- 指定mysql的数据目录
--user --- 指定管理用户
cp -a /application/mysql/support-files/mysql.server /etc/init.d/mysqld
须要修改启动文件的mysql路径:
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
mysql默认配置文件保存位置: /etc/my.confmysql
\cp /application/mysql/support-files/my-default.cnf /etc/my.conf
/etc/init.d/mysqld start --- 启动
/application/mysql/bin/mysqladmin -u root password '123' --- 设置用户密码linux
/application/mysql/bin/mysql -u root -p123 --- 登录nginx
更加详细的Nginx讲解请看: http://www.cnblogs.com/lyq863987322/p/8111347.htmlweb
yum install -y pcre-devel openssl-devel
cd /server/tools/ wget -q http://nginx.org/download/nginx-1.10.2.tar.gz tar xf nginx-1.10.2.tar.gz
cd nginx-1.10.2 useradd -s /sbin/nologin -M www -u 2222 ./configure --prefix=/application/nginx-1.10.2 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
make && make install ln -s /application/nginx-1.10.2 /application/nginx
egrep -v "#|^$" /application/nginx/conf/nginx.conf.default >/application/nginx/conf/nginx.conf
/application/nginx/sbin/nginx
这里就能web网页访问,可是没什么东西,具体能够看看个人另外一篇Nginx的详解sql
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
libiconv-devel ---字符集转换库 这个软件须要编译安装数据库
说明:此软件在centos6.8以后,系统已经自带此软件功能,能够不进行安装centos
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar xf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make && make install
还须要安装三个与数据加密相关的软件 --- 须要epel源获取app
yum -y install libmcrypt-devel mhash mcrypt
tar xf php-5.5.32.tar.gz
这里根据不一样的需求增长初始化内容
cd php-5.5.32 ./configure --prefix=/application/php-5.5.32 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --enable-opcache=no --with-mysqli=mysqlnd --with-gettext
make && make install ln -s /application/php-5.5.32/ /application/php
cp /server/tools/php-5.5.32/php.ini-production /application/php/lib/php.ini cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf
/application/php/sbin/php-fpm
关于wordpress的下载百度一下一大堆,我就省略了
tar xf wordpress-4.7.3-zh_CN.tar.gz mv wordpress /application/nginx/html/blog/
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; client_max_body_size 1024M; keepalive_timeout 65; server { listen 80; server_name blog.zxpo.com; location / { root html/blog/wordpress; index index.php index.html index.htm; } location ~* .*\.(php|php5)?$ { root html/blog/wordpress; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
从新启动Nginx
[root@webtest tools]# /application/nginx/sbin/nginx -t --- 检查Nginx配置是否正确 nginx: the configuration file /application/nginx-1.10.2/conf/nginx.conf syntax is ok nginx: configuration file /application/nginx-1.10.2/conf/nginx.conf test is successful [root@webtest tools]# /application/nginx/sbin/nginx -s reload --- 平滑重启nginx
chown -R www.www /application/nginx/html/blog/wordpress/
mysql> create database web03; Query OK, 1 row affected (0.00 sec) mysql> grant all on web03.* to 'web03'@'172.16.1.0/255.255.255.0' identified by '123'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
注意主机hosts文件解析
完成了。这就搭建完成了一个简单的博客网站,。哪里不懂能够私信我。