您的位置:首页 > 博客中心 > 数据库 >

wordpress安装(ubuntu+nginx+php+mariadb)

时间:2022-03-10 17:11

deb-srchttp://nginx.org/packages/ubuntu/ precise nginx

 

sudo apt-get update

sudo apt-get install nginx -y

init_connect=‘SETNAMES utf8‘

加入到[mysqld]

lower_case_table_names=1

skip-name-resolve

sudo /etc/init.d/mysql reload

         user = nginx

group = nginx

                   listen.mode= 0666

 

sudo /etc/init.d/php5-fpm restart

#将socket文件,放在内存文件区域,有利于提升性能

 

sudo vim /etc/nginx/conf.d/default.conf

##########################################################

server {

   listen       80;

   server_name  *.aser.me aser.me*.showall.org showall.org;

root /home/www/www;

        index index.php;

       location = /favicon.ico {

                log_not_found off;

                access_log off;

       }

       location / {

                try_files $uri $uri//index.php?$args ;

       }

       location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {

                expires max;

                log_not_found off;

       }

    location ~ \.php$ {

                fastcgi_index  index.php;

                fastcgi_passunix:/var/run/php5-fpm.sock;

                fastcgi_param  SCRIPT_FILENAME  /home/www/www$fastcgi_script_name;

       include        fastcgi_params;

    }

   error_page   500 502 503 504  /50x.html;

   location = /50x.html {

       root   /usr/share/nginx/html;

    }

   location ~ /\.ht {

       deny  all;

    }

   location ~* /(?:uploads|files)/.*\.php$ {

       deny all;

    }

}

##########################################################

sudo service php5-fpm restart

sudo service nginx restart

配置wordpress数据库

sudo vim /etc/hosts

127.0.0.1 dbhost

 

建立wordpress库

mysql -uroot-p

CREATE DATABASE wordpress;

GRANT ALL PRIVILEGES ON wordpress.* TO"wordpress"@"dbhost" IDENTIFIED BY "password";

GRANT ALL PRIVILEGES ON wordpress.* TO"wordpress"@"localhost" IDENTIFIED BY "password";

GRANT ALL PRIVILEGES ON wordpress.* TO"wordpress"@"127.0.0.1" IDENTIFIED BY "password";

FLUSH PRIVILEGES;

EXIT;

 

配置wordpress连接数据库的信息

sudo cp -rp wp-config-sample.phpwp-config.php

sudo vim /home/www/www/wp-config.php

define(‘DB_NAME‘,‘wordpress‘);

define(‘DB_USER‘,‘wordpress‘);

define(‘DB_PASSWORD‘,‘password‘);

define(‘DB_HOST‘,‘dbhost‘);

 

更安全更详细设置参考:

http://conanca.iteye.com/blog/1044256

http://codex.wordpress.org/zh-cn:%E5%AE%89%E8%A3%85_WordPress

http://codex.wordpress.org/Nginx

http://wiki.nginx.org/WordPress



来自为知笔记(Wiz)


wordpress安装(ubuntu+nginx+php+mariadb),布布扣,bubuko.com

热门排行

今日推荐

热门手游