我在ubuntu上安了wordpress,但是127.0.0.1却不能访问

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
trg5236
帖子: 3
注册时间: 2013-05-13 21:22
系统: win7

我在ubuntu上安了wordpress,但是127.0.0.1却不能访问

#1

帖子 trg5236 » 2013-05-13 21:29

http://localhost/wordpress/可以
但是http://127.0.0.1/wordpress/却不行,出下面的错
Neither /etc/wordpress/config-127.0.0.1.php nor /etc/wordpress/config-0.0.1.php could be found.
Ensure one of them exists, is readable by the webserver and contains the right password/username.

ubuntu装在虚拟机里,本机通过IP访问也显示错误
host文件没有问题

想问一下这个要怎么修?
头像
sense
帖子: 308
注册时间: 2007-02-14 13:54

Re: 我在ubuntu上安了wordpress,但是127.0.0.1却不能访问

#2

帖子 sense » 2013-05-14 14:11

Neither /etc/wordpress/config-127.0.0.1.php nor /etc/wordpress/config-0.0.1.php could be found.
就是说配置文件没找到咯,我估计 /etc/wordpress/localhost.php 是有的,可以做一个 symlink 嘛

代码: 全选

ln -s /etc/wordpress/localhost.php /etc/wordpress/config-127.0.0.1.php
trg5236
帖子: 3
注册时间: 2013-05-13 21:22
系统: win7

Re: 我在ubuntu上安了wordpress,但是127.0.0.1却不能访问

#3

帖子 trg5236 » 2013-05-14 20:08

sense 写了:
Neither /etc/wordpress/config-127.0.0.1.php nor /etc/wordpress/config-0.0.1.php could be found.
就是说配置文件没找到咯,我估计 /etc/wordpress/localhost.php 是有的,可以做一个 symlink 嘛

代码: 全选

ln -s /etc/wordpress/localhost.php /etc/wordpress/config-127.0.0.1.php
这样是能解决,
但是我觉得配IP或域名之类的应该是apache做的事情
为什么wordpress还要插一脚?

而且还有个问题,
以下是apache2 的默认设置,本机应该是可以访问VM里的wordpress或phpmyadmin的
但是却不行。。。实在搞不懂,
而且本机通过http://192.168.73.131/wordpress/访问虚拟机中的wordpress,也要求有配置/etc/wordpress/config-192.168.73.131.php
这个太奇怪了。。

代码: 全选

<VirtualHost *:80>
	ServerAdmin webmaster@localhost

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
trg5236
帖子: 3
注册时间: 2013-05-13 21:22
系统: win7

Re: 我在ubuntu上安了wordpress,但是127.0.0.1却不能访问

#4

帖子 trg5236 » 2013-05-14 20:51

1. 更改数据库中wp_options表下的siteurl内容,将其更改为宿主机的ip。如http://192.168.2.16/wordpress
2. 更改数据库中wp_options表下的home内容(这个大概在第二页),同样改为http://192.168.2.16/wordpress

http://superuser.com/questions/276902/t ... -wordpress

3. sudo ln -s /etc/wordpress/config-localhost.php /etc/wordpress/config-default.php
(this is because at last wp-config.php looks for config-default.php)

终于搞定wordpress的问题了,三个步骤都得用才行。
为什么这么普遍的问题网上一点都搜不到。。。

PS:还剩下apache的那个问题不知道肿么办。。。
回复