【发布时间】:2015-03-18 17:03:19
【问题描述】:
我正在尝试设置我们的博客,但无法破解正确的配置...
文件夹结构为:
var/www/domain
| - website
| - webapp
| - blog
Apache 配置:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin admin@example.com
# -------------------------------------
# ------ Web Stuff ------
# -------------------------------------
# Website
DocumentRoot /var/www/example.com/production/website/code/wwwroot
<Directory "/var/www/example.com/production/website/code/wwwroot">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
# Webapp
Alias /pages /var/www/example.com/production/webapp
<Directory "/var/www/example.com/production/webapp">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
# Blog
Alias /blog /var/www/example.com/production/blog
<Directory "/var/www/example.com/production/blog">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php index.html
CustomLog ${APACHE_LOG_DIR}/domain_production_access.log combined
ErrorLog ${APACHE_LOG_DIR}/domain_production_error.log
LogLevel warn
# -------------------------------------
# -------------------------------------
# Catch any requests for example.com and redirect them to www.example.com
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) https://www.example.com/$1 [NC,R=301,L]
# Catch any http requests (except for status check and those that originated from
# this server) and redirect them to https
RewriteEngine On
RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule !/api/aws/check https://%{SERVER_NAME}%{REQUEST_URI} [NC,R=301,L]
# Django web service - all URLs beginning with /api
WSGIDaemonProcess www.example.com processes=8 threads=1 display-name=%{GROUP}
... FOLLOWED BY A LOT OF SETTINGS FOR API ...
<LocationMatch "\.(jpg|css|gif|pdf|ico)$">
SetHandler None
</LocationMatch>
# Zip output
AddOutputFilterByType DEFLATE text/css text/html application/x-javascript application/javascript application/json
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
我已经在博客目录中安装了 WordPress 并连接到数据库。但是当我尝试打开 https://www.example.com/blog 时,我看到了内容但没有样式(所有资产都来自非 https 地址)。
我无法访问 wp-admin,所以我手动将数据库中的 url 更改为 https,但在博客页面上仍然看不到任何资产,并且在尝试访问 wp-admin 时出现重定向循环。
【问题讨论】: