在ubuntu @ ec2中在虚拟主机上设置wordpress时出现问题

时间:2017-12-18 09:58:26

标签: php wordpress apache

尝试在我的ubuntu ec2实例上的一个虚拟主机上设置Wordpress。面对两个问题。

    当我离开时,
  1. mydomain.com会重定向到mydomain.com/wordpress 希望Wordpress在mydomain.com上呈现。
  2. 主题无法正确显示,无论是否在 mydomain.com/wordpress或在wp-admin安装时。我可以看到主题出现在/var/lib/wordpress/wp-content/themes
  3. 浏览器控制台显示以下内容:

    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
    

0 个答案:

没有答案