花了9塊錢 買了阿里 對(duì)象存儲(chǔ)服務(wù)1年. 免費(fèi) 獲得 半年 云服務(wù)器 ECS
花了2快錢 買了一個(gè)域名 www.caicl.online 一年
配置 : CPU: 1核 內(nèi)存: 2048 MB(I/O優(yōu)化) 1Mbps帶寬
CentOS 7.2 64位系統(tǒng)(這個(gè)可以隨時(shí)換win sever 或其他linux系統(tǒng))
一. 配置環(huán)境
lamp:
CentOS
Ubantu WordPress lamp教程
由于本人設(shè)置Ubantu的ftp服務(wù)器始終沒成。。。
最終使用的是CentOS.
PS:感覺centos的教程要多很多
<b><strong>Linux Apache Mysql/MariaDB Perl/PHP/Python</strong></b>一組常用來搭建動(dòng)態(tài)網(wǎng)站或者服務(wù)器的開源軟件,本身都是各自獨(dú)立的程序,但是因?yàn)槌1环旁谝黄鹗褂?,擁有了越來越高的兼容度,共同組成了一個(gè)強(qiáng)大的Web應(yīng)用程序平臺(tái)。
二. 安裝 wordpress
使用 phpMyAdmin 為Wordpress新建mysql數(shù)據(jù)庫:
wrodpress中文網(wǎng)文檔登錄phpMyAdmin
http://localhost/phpmyadmin
2.1.創(chuàng)建WordPress的數(shù)據(jù)庫
2.2.新建一個(gè)用戶(mysql) ,不用點(diǎn)擊添加同名數(shù)據(jù)庫。
2.3.編輯用戶權(quán)限 添加到剛才創(chuàng)建的WordPress數(shù)據(jù)庫并賦予所有增刪改查等權(quán)限。
PS:有沒有可能直接創(chuàng)建用戶并添加同名數(shù)據(jù)庫就可以(原諒我這不懂mysql的人)從WordPress中文網(wǎng)下載wordpress中文版 下載 tar.gz文件
在本地解壓后將wordpress文件夾(不包括問價(jià)夾 ps:切記)內(nèi)所有文件
使用FileZilla /var/www/html 目錄下登錄 http://localhost/wordpress/wp-admin/install.php 按步驟操作wrodpress就安裝完了。
此時(shí)打開我的網(wǎng)址出現(xiàn)以下現(xiàn)象。
PS: 訪問 http://localhost/wordpress/ 才會(huì)出現(xiàn)wrodpress網(wǎng)頁。

后加:
開始我使用chorme瀏覽器查看網(wǎng)頁時(shí)。能夠解決問題了,但是使用其他瀏覽器都不行。
原因是:當(dāng)時(shí)我傳wordpress程序時(shí),直接把wrodpress文件夾放到了/var/www/html目錄下 。也就是說我的WordPress目錄為/var/www/html/wrodpress.這是我始終出現(xiàn)index of / 問題的最終原因。
問題原因:
- apache 默認(rèn)的靜態(tài)頁面目錄為 /var/www/html
- wrodpress 所在文件夾需要添加.htaccess 文件
- 修改httpd.conf 文件
解決辦法:
- 在/var/www/html 目錄(wrodpress根目錄)中添加如下.htaccess 文件:
vi /var/www/html .htaccess
內(nèi)容為:
DirectoryIndex index.php index.html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
```
2. 打開apache配置文件 `vi /etc/httpd/conf/httpd.conf`
將AllowOverride 配置為 All
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named explicitly --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All 找到此處默認(rèn)是 AllowOverride Nome 改為 All
#
# Controls who can get stuff from this server.
#
Require all granted
需要說明的是:
>1. hatccess文件需要 AllowOverride All 的配置
2. <big>Ubantu系統(tǒng)使用apache2 httpd.conf文件是空的 </big>
- 配置.htaccess文件的是**/etc/apache2/sites-enabled 目錄下的 000-default** 文件
- Ubantu重啟Apache2
/etc/init.d/apache2 restart
配置完 .hatccess后 輸入www.caicl.online 就自動(dòng) 跳轉(zhuǎn)為 www.caicl.onlie/wordpress 了也就能正常顯示wordpress網(wǎng)頁了
#### 解決WordPress網(wǎng)頁顯示公網(wǎng)IP的問題。
[教程地址](http://blog.csdn.net/zcl369369/article/details/40949971)
> 1. 登錄 WordPress網(wǎng)站的 **儀表盤**
2. 在**設(shè)置** ---- 常規(guī)選項(xiàng) 中修改 wordpress地址和 站點(diǎn)地址
3. 清空瀏覽器緩存。