搭环境,参考(其中的步骤1,2,3) http://www.cnblogs.com/lynch_world/archive/2012/01/06/2314717.html
说简单点就是执行如下命令:sudo apt-get install apache2sudo apt-get install libapache2-mod-php5 php5sudo apt-get install php5-gd php5-mysqlsudo 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" ; |
Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.
- Database name
- Database username
- Database password
- Database host
- 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.confand restart apache2 servicesudo /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` =1; `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);