系統環境版本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文件解析
完成了。這就搭建完成了一個簡單的博客網站,。哪裏不懂能夠私信我。