WordPress官方地址php
服務器環境要求mysql
|
下載,目錄是站點的根目錄數據庫
cd /application/nginx/html/blog wget https://cn.wordpress.org/wordpress-4.7-zh_CN.tar.gz
在mysql中建立一個新的數據庫安全
mysql --user root --password 123456
mysql>create database wordpress; mysql>show databases like 'wordpress'; mysql>grant all on wordpress.* to identified by '123456'; mysql>flush privileges; mysql>select user,host from mysql.user;
解壓縮WordPress包bash
tar xf wordpress-4.7-zh_CN.tar.gz mv wordpress/* . rm -rf wordpress cd /application/nginx/html #對於單機的模式如下是比較安全的方式,可是仍是不能防住***的執行, #最安全的方式應該是分開存儲,能夠上傳的東西不能夠有執行的權限,經過磁盤掛在 #限制執行(noexec) chown -R nginx.nginx blog/ find ./blog/ -type f|xargs chmod -R 644 find ./blog/ -type d|xargs chmod -R 755 mkdir blog/wp-content/uploads chown -R nginx.nginx blog/wp-content/uploads/
打開網址,會提示須要初始化並建立wp-config.php文件,可是由於無權限,因此能夠手工建立服務器
在網站的管理界面中找到設置→固定鏈接,在自定義中,增長/archive/%post_id%.html
在nginx.conf文件中增長
server { listen 8003; server_name www.etiantian.org; location / { root html/blog; index index.php; 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; } } location ~.*\.(php|php5)?$ { root html/blog; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } access_log logs/access_blog.log main; }
數據庫遷移
mysqldump -uroot -p wordpress > wordpress.sql scp -P 22 wordpress.sql :~
切換到192.168.80.100
mv /home/user/wordpress.sql ~ mysql -u root -p
建立wordpress數據庫和wordpress用戶,並限制能夠登錄的主機,注意用%表示通配符;
create database wordpress; grant all on wordpress.* to identified by '123456'; flush privileges;
回到linux下
mysql -uroot -p wordpress < wordpress.sql
回到原來的主機下關閉mysql
/etc/init.d/mysqld stop
修改wp-config.php文件中的鏈接參數後,測試鏈接。