尝试在我的ubuntu ec2实例上的一个虚拟主机上设置Wordpress。面对两个问题。
mydomain.com
会重定向到mydomain.com/wordpress
希望Wordpress在mydomain.com
上呈现。mydomain.com/wordpress
或在wp-admin
安装时。我可以看到主题出现在/var/lib/wordpress/wp-content/themes
。浏览器控制台显示以下内容:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "mydomain.com/wordpress/wp-content/themes/twentysixteen/genericons/genericons.css/?ver=3.4.1".
Resource interpreted as Stylesheet but transferred with MIME type text/html: "mydomain.com/wordpress/wp-content/themes/twentysixteen/style.css/?ver=4.4.2".
?ver=20160816:1 Uncaught SyntaxError: Unexpected token <
?ver=20160816:1 Uncaught SyntaxError: Unexpected token <
上下文:
1)通过以下方式安装Wordpress:https://help.ubuntu.com/community/WordPress。
2)/var/www/mydomain.com/public_html /:
中的文件index.php:
<?php
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
wordpress/ -> /usr/share/wordpress
3)/etc/apache2/sites-enabled/mydomain.com.conf的内容:
ServerAdmin webmaster@localhost
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
<Directory "/var/www/mydomain.com/public_html">
AllowOverride All
</Directory>
Alias /wp-content /var/lib/wordpress/wp-content
<Directory /usr/share/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/lib/wordpress/wp-content>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
4)/etc/wordpress/config-mydomain.com.php的内容:
<?php
# Created by /usr/share/doc/wordpress/examples/setup-mysql
#...mysql entries...
define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
?>
5)mydomain.com/wordpress/wp-admin/options-general.php中的条目:
Wordpress address: mydomain.com/wordpress
Site address: mydomain.com