Just changed the server system from CentOS to Ubuntu, after installing mysql,apache,php and WordPress, it is OK to open the homepage, but there is an error when opening the article page. Because of the use of custom fixed link settings, it is natural that Apache's rewrite function is problematic. Open/etc/apache2 This directory is ready to modify the configuration file, found that the previously used httpd.conf this file is empty. Instead, there are many other catalogs. So Google it.
Apache Configuration Instructions View https://help.ubuntu.com/12.04/serverguide/httpd.html
Several of these files and directories function as:
apache2.conf:Apache的主要配置文件,包含全局配置。 conf.d:Apache全局配置文件,其他需要使用Apache的包可以在这个目录下创建文件或者链接。 envvars:Apache2环境变量设置。 httpd.conf:遗留的Apache2主要配置文件。这个文件是空的,其中的配置选项都转移到其他配置文件里了。这个文件可以进行Apache全局配置。 mods-available:这个目录包含模块和模块配置文件,不是所有的模块都有配置文件。 mods-enabled:持有/etc/apache2/mods-available目录下文件的链接,当该目录下有一个模块文件和其配置文件,那么Apache重启后该模块将生效。 ports.conf:配置Apache监听的端口。 sites-available:这个目录包含Apache虚拟主机的配置文件。虚拟主机允许Apache配置多个站点并为每个站点配置不同的参数。 sites-enabled:持有/etc/apache2/sites-available目录下文件的链接。当Apache重启后,该目录中包含的站点将会被激活。
Combined with the above configuration instructions can be found that the Apache configuration file is very modular, enabling modules, virtual host are very simple.
Here's how to enable the Mod_rewrite module.
The first way:
The second way:
sudo ln-s/etc/apache2/mods-available/rewrite.load/etc/apache2/mods-enabled/rewrite.load |
Regardless of which method is used, /etc/apache2/mods-enabled
a link is established under this directory, as long as the server is restarted to take effect. Of course, to make the rewrite effective, you need to modify the additional configuration:
sudo vim/etc/apache2/sites-enabled/000-default |
Modify the allowoverride None to allowoverride all, and then restart the server.
Sudo/etc/init.d/apache2 restart |
Ubuntu Apache Configuration and open mod_rewrite module