孤独750 发表于 2018-11-19 10:38:48

apache静态化页面

  Apache开启静态化页面
  

  博主未解决的坑:
  本人首次搭建LAMP采用的是编译安装HTTPD服务,在开启静态化页面时发现在httpd.conf中没有LoadModule rewrite_module libexec/mod_rewrite.so代码,手动添加进去重启apache时报错;
查看文件.htaccess也正常:
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
编译安装httpd的版本、参数如下:
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.2.31.tar.gz
#tar xf httpd-2.2.31.tar.gz
#cd httpd-2.2.31
#yum install zlib zlib-devel -y
./configure \
--prefix=/application/apache2.2.31 \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite
#make
#make install总之问题为解决

  本着简单、易用、高效的原则,本人建议采用yum安装;
  

  Apache实现静态化页面的实际操作:
  配置文件httpd.conf中:

  AllowOverride None改为AllowOverride All
        文件中要有LoadModule rewrite_module libexec/mod_rewrite.so,代码前若有#注释,把注释去掉,若没有此代码则手动添加进去;
        .htaccess文件:
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
  文件中若没有上述代码则手动添加到文件中
  

  

  

  




页: [1]
查看完整版本: apache静态化页面