ubuntu安装wordpress4

搭环境,参考(其中的步骤1,2,3) http://www.cnblogs.com/lynch_world/archive/2012/01/06/2314717.html
说简单点就是执行如下命令:
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5 php5
sudo apt-get install php5-gd php5-mysql
sudo apt-get install mysql-server mysql-client

然后新建test.php扔到/var/www/下面,然后访问http://localhost/test.php结果找不到页面。
<?php echo "hello world" ?>

阅读:http://www.2cto.com/os/201307/226374.html
打开文中提到的/etc/apache2/sites-enabled/000-default.conf
发现DocumentRoot指向了/var/www/html,所以server当然找不到test.php了。把DocumentRoot修改成/var/www重新访问好了。

接下来是把wordpress解压:
sudo unzip wordpress-4.0.zip -d /var/www

然后把这个目录的属主改成我的,并设置权限
cd /var/www
sudo chown -R cyper wordpress/
chmod 755 wordpress/
查看权限:
ls -ld wordpress/
确保目录权限没有问题。

然后就可以打开wordpress首页了。TMD的打开首页会尝试访问fonts.googleapis.com. localhost竟然半天打不开, SB wordpress。
这里有解决方案:http://www.jsgblog.com/944.html
就是建个css文件,修改 wp-includes/script-loader.php 文件,修改如下变量的值指向这个新建的css文件。
这个google-font.css文件内容如下:

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  src: local('Open Sans Light'), local('OpenSans-Light'), url(../fonts/google/DXI1ORHCpsQm3Vp6mXoaTRa1RVmPjeKy21_GQJaLlJI.woff) format('woff');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: local('Open Sans'), local('OpenSans'), url(../fonts/google/u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(../fonts/google/MTP_ySUJH_bn48VBG8sNSha1RVmPjeKy21_GQJaLlJI.woff) format('woff');
}
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 300;
  src: local('Open Sans Light Italic'), local('OpenSansLight-Italic'), url(../fonts/google/PRmiXeptR36kaC0GEAetxrsuoFAk0leveMLeqYtnfAY.woff) format('woff');
}
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 400;
  src: local('Open Sans Italic'), local('OpenSans-Italic'), url(../fonts/google/xjAJXh38I15wypJXxuGMBtIh4imgI8P11RFo6YPCPC0.woff) format('woff');
}
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 600;
  src: local('Open Sans Semibold Italic'), local('OpenSans-SemiboldItalic'), url(../fonts/google/PRmiXeptR36kaC0GEAetxmWeb5PoA5ztb49yLyUzH1A.woff) format('woff');
}



需要修改的script-loader.php的那一行的内容如下:

$
open_sans_font_url = "/wp-includes/css/google-font.css" ;

这回首页终于TMD打开了,自动跳转到:http://localhost/wordpress/wp-admin/setup-config.php

Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.

  1. Database name
  2. Database username
  3. Database password
  4. Database host
  5. Table prefix (if you want to run more than one WordPress in a single database)

We’re going to use this information to create awp-config.phpfile. If for any reason this automatic file creation doesn’t work, don’t worry. All this does is fill in the database information to a configuration file. You may also simply openwp-config-sample.phpin a text editor, fill in your information, and save it aswp-config.php. Need more help? We got it.

In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready…

很好理解,下一步,NND,提示得先建wordpress数据库, 第一反应是访问http://localhost/phpmyadmin提示找不到页面:
先sudo apt-get install phpmyadmin
然后
If you are getting “Page not found” issue .Include the below line in /etc/apache2/apache2.conf file.
Include /etc/phpmyadmin/apache.conf
and restart apache2 service
sudo /etc/init.d/apache2 restart
好了phpmyadmin打开了。然后建好wordpress数据库,编码选择utf8 generic_ci,回到wordpress向导页面, 我把表的前缀从wp_改成work_
最后向导会尝试创建wp-config.php结果没有权限,哈哈,我在wp根目录下手工创建了这个文件, 然后rerun搞定了。
接下是是的博客的title,我设置成record everything,用户名是cyper密码是一句骂人的。。。接下来呢。。

我想把wordpress目录重命名成wordpress_work,应该没有问题。(发现没有权限)
sudo chown -R cyper /var/www
chmod 755 /var/www
这下满意了吧。

然后通过http://localhost/wordpress_work访问,结果首页能打开但是css啥的完全走样,原来同时需要修改options表中的siteurl和home的值:
如下:
UPDATE `wordpress`.`work_options` SET `option_value` = 'http://localhost/wordpress_work' WHERE `work_options`.`option_id` =;
UPDATE `wordpress`.`work_options` SET `option_value` = 'http://localhost/wordpress_work' WHERE `work_options`.`option_id` =2;

可以写得简单点么?

mysql -u root -p*****
use wordpress

UPDATE work_options 
SET option_value = 'http://localhost/wordpress_work' 
WHERE option_id in (1,2);








转载于:https://my.oschina.net/uniquejava/blog/348380

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值