我有一个正在运行的CentOS 7和Apache 2 mariadb堆栈,其中包含vhost,让我们加密。我已经使用debian风格(站点可用->站点启用)在虚拟主机上安装了WordPress 4.9.6。
我的问题是我不能使用permalinks。我将我的服务器配置复制到下面。
getenforce
Disabled
/etc/httpd/sites-available/example.com.conf
:
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/error.log
CustomLog /var/www/example.com/requests.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
/etc/httpd/sites-available/example.com-le-ssl.conf
:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/error.log
CustomLog /var/www/example.com/requests.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
</IfModule>
Apache配置文件
/etc/httpd/conf/httpd.conf
:
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
配置。public\\u html目录中的文件
/var/www/example.com/public_html/.htaccess
:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我已在WordPress admin上启用永久链接设置:
https://example.com/%postname%/
的权限
.htaccess
文件包括:
-rw-r--r--1阿帕奇apache 235 Jun 24 13:54。htaccess
sudo httpd -M
显示:
(..)
rewrite_module (shared)
(..)