【问题标题】:Apache shows it works page even if i change the path of document root即使我更改文档根目录的路径,Apache 也会显示它的工作页面
【发布时间】:2015-06-28 18:39:09
【问题描述】:

我的问题是,当我放 wordpress.local.fr 来显示我的 wordpress 的欢迎页面时,它总是向我显示它可以正常工作的页面。

但是当我制作 wordpress.local.fr/wordpress 时它可以工作

这就是我所做的:

ubuntu 服务器的 IP 地址:192.168.52.130

在 etc/apache2/sites-available/wordpress 中

<VirtualHost *:80>
    ServerAdmin wordpress.local.fr
    DocumentRoot /var/www/wordpress
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

等/主机:

192.168.52.130 wordpress.local.fr
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

托管窗口:

192.168.52.130 wordpress.local.fr

wordpress 文件夹包含我所有的文件,没有子文件夹,我使用 samba 在 windows 和 ubuntu 服务器之间共享 /var/www/

[Share]
  comment = Shared
  path    = /var/www/
  browseable = yes
  read only = no
  guest ok = yes
  writeable = yes

我不知道我哪里出错了。 我可以检查和更改什么?

编辑

我试图在 fileindex 文件夹中只制作一个 txt 文件,而不是我的 wordpress 项目,并在 DocumentRoot /var/www/fileindex 中制作总是我有它可以工作的页面,所以 DocumentRoot 没有被考虑在内

我的 htaccess 文件(在我的 wordpress/ 文件夹中)是:

# BEGIN WordPress
# END WordPress

我已经编辑了我的 htaccess 文件(在我的 wordpress/ 文件夹中)。到那个:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

我已经将我的 serverAdmin 更改为 serverName :

<VirtualHost *:80>
    ServerName wordpress.local.fr
    DocumentRoot /var/www/wordpress/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

重启我的apache后还是一样的问题

提前致谢

【问题讨论】:

  • 您在进行更改后是否重新启动了 Apache?
  • 是的,我已经重新启动了我的 apache,它存在另一个文件,它也有根文件?或仅在可用的网站中

标签: windows wordpress apache ubuntu-server


【解决方案1】:

在你的配置中我看到了

ServerAdmin wordpress.local.fr

ServerAdmin 指令用于在 Apache 遇到错误时接收电子邮件,它应该是

ServerName wordpress.local.fr

【讨论】:

  • 谢谢...我在重新启动我的 apache 后对我的配置进行了编辑,但它仍然是同样的问题
  • 您的浏览器缓存,尝试清除缓存并重新加载页面
  • 糟糕!你的文件在 etc/apache2/sites-available/wordpress 它还没有启用,创建一个符号链接到启用目录sudo ln /etc/apache2/sites-available/wordpress /etc/apache2/sites-enabled/wordpress
  • 它的工作原理非常感谢你!!!!!!!一个问题我们也可以使用 sudo mv 代替 sudo ln ...
  • 是的,但符号链接也可以
【解决方案2】:

您似乎需要更新您的.htaccess 文件(在您的wordpress/ 文件夹中)。

RewriteBase/ 更改为 /wordpress/

玩得开心!

【讨论】:

  • 我的 .htaccess 文件在我的 wordpress/ 文件夹中包含这个 # BEGIN WordPress # END WordPress 我如何更新它?
  • 我试图在 fileindex 文件夹中只制作一个 txt 文件,而不是我的 wordpress 项目,并在 DocumentRoot /var/www/fileindex 中制作我总是有它的工作页面,谢谢您的回答
猜你喜欢
  • 1970-01-01
  • 2016-06-21
  • 2016-04-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-26
相关资源
最近更新 更多