博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ubuntu安装wordpress4
阅读量:7117 次
发布时间:2019-06-28

本文共 4443 字,大约阅读时间需要 14 分钟。

hot3.png

搭环境,参考(其中的步骤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? .

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的值:

如下:
 `wordpress`.`work_options`  `option_value` = 'http://localhost/wordpress_work' WHERE `work_options`.`option_id` =;
 `wordpress`.`work_options`  `option_value` = 'http://localhost/wordpress_work' WHERE `work_options`.`option_id` =2;
可以写得简单点么?

mysql -u root -p*****use wordpressUPDATE work_options SET option_value = 'http://localhost/wordpress_work' WHERE option_id in (1,2);

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

你可能感兴趣的文章
Citrix 实践中的问题及解决
查看>>
类代理java设计模式---动态代理(简单笔记)
查看>>
深入理解JavaScript定时器
查看>>
从零开始学建站-主机篇
查看>>
hashchange
查看>>
Oracle客户端tnsnames.ora连接配置
查看>>
Redis入门学习
查看>>
C#组播消息收发
查看>>
IIS故障问题(Connections_Refused)分析及处理【转】
查看>>
Windows下编译eXosip、osip,以及UAC和UAS的例子
查看>>
FFT算法的完整DSP实现
查看>>
vim 之cscope的使用
查看>>
Linux下动态共享库加载及使用详解
查看>>
Kivy: Crossplatform Framework for NUI
查看>>
c字符输出
查看>>
DOS下文件操作命令
查看>>
Linux——系统引导流程学习简单笔记
查看>>
Bootstrap3.0学习第十二轮(导航、标签、面包屑导航)
查看>>
The Definitive Guide To Django 2 学习笔记(八) 第四章 模板 (四)基本的模板标签和过滤器...
查看>>
【转】Mysql行转换为列
查看>>