wordpress on nginx 搭建

内网搞了了bolg,采用了nginx+php+mysql+wordpress。整个过程并不复杂,记录下遇到的问题。

1.安装nginx

./configure –prefix=/usr/local/nginx –with-zlib –with-pcre=/opt/ftp/http-server/pcre-8.34 –with-http_perl_module –with-http_stub_status_module –with-http_image_filter_module –with-http_gunzip_module –with-http_gzip_static_module

2.php

./configure –prefix=/usr/local/php '–with-config-file-path=/usr/local/php-5.4.23/etc' '–enable-fpm' '–enable-pcntl' '–enable-shmop' '–enable-sysvsem' '–enable-inline-optimization' '–disable-rpath' '–enable-safe-mode' '–with-mysql=mysqlnd' '–with-mysqli=mysqlnd' '–with-pdo-mysql=mysqlnd' '–with-libxml-dir=/usr/local' '–enable-xml=/usr/local' '–with-openssl' –with-zlib '–enable-bcmath' '–with-bz2' '–enable-zip' '–enable-exif' '–with-gd' '–enable-gd-native-ttf' '–with-freetype-dir=/usr/local' '–with-jpeg-dir=/usr/local' '–with-png-dir' '–with-mhash' '–with-mcrypt=/usr/local' '–enable-mbstring' '–enable-mbregex' '–with-iconv-dir=/usr/local' '–with-curl' '–with-curlwrappers' '–enable-ftp' '–enable-sockets'

3.mysql

cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql/ -DSYSCONFDIR=/etc/my.cnf -DMYSQL_UNIX_ADDR=/opt/mysql/tmp/mysqld.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ZLIB=/usr/local/lib/ -DWITH_READLINE=1 -DWITH_DATADIR=/opt/mysql/data/ -DWITH_SSL=bundled -DENABLED_LOCAL_INFILE=1-DWITH_READLINE=1 -DWITH_DEBUG=0

make && make install

4.wordpress安装

5.配置

这次遇到麻烦的地方主要有三点:

1.mysql初始化

scripts/mysql_install_db –user mysql –basedir= –datadir=

2.mysql设置密码需要先执行

set old_passwords = 0;

3.nginx重写规则

        if (-f $request_filename/index.html){
            rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }

这样访问目录时就会自动访问下面的index.php了。

你可能感兴趣的:(wordpress on nginx 搭建)