在debian安装上的Wordpress apache2虚拟主机配置

时间:2016-05-15 02:26:53

标签: wordpress apache debian virtualhost httpd.conf

我试图在我的服务器上设置一个wordpress网站,该网站还托管另一个网站。我只能使用wordpress网站来处理网址<div class="container"> <div class="box-container"> <div class="box1"> </div> <div class="box2" id="box"> <div class="box1"></div> <div class="box1"></div> <div class="box1"></div> <div class="box1"></div> </div> </div> </div> <div class="container-2"> </div>

我希望能够从blog.murmilosoftware.com/wp简单地访问它。

问题是我现在输入blog.murmilosoftware.com时会显示blog.murmilosoftware.com提供的同一页面。

我已附加murmilosoftware.com的两个网站可用配置文件。

blog.murmillosoftware.com.conf

/etc/apache2/sites-available

murmillosoftware.com.conf

Alias /wp/wp-content /var/lib/wordpress/wp-content
Alias /wp /usr/share/wordpress
<Directory /usr/share/wordpress>
    Options FollowSymLinks
    AllowOverride Limit Options FileInfo
    DirectoryIndex index.php
    Require all granted
</Directory>
<Directory /var/lib/wordpress/wp-content>
    Options FollowSymLinks
    Require all granted
</Directory>
  

忘了重启我的apache服务。它现在正在运作。

1 个答案:

答案 0 :(得分:2)

您是否注意到<VirtualHost *:80>文件中的murmillosoftware.com.conf?这称为虚拟主机配置。在您当前的blog.murmillosoftware.com.conf中,您所做的只是创建/wp路径的别名,这就是您可以在那里浏览wordpress的原因。

按如下方式更新您的blog.murmillosoftware.com.conf(可能是错误的,请继续检查服务器日志):

<VirtualHost *:80>
    ServerAdmin erik@murmillosoftware.com
    ServerName blog.murmillosoftware.com
    DocumentRoot /usr/share/wordpress

    # Custom log files, to differentiate from root server
    ErrorLog ${APACHE_LOG_DIR}/error-wordpress.log
    CustomLog ${APACHE_LOG_DIR}/access-wordpress.log combined

    Alias /wp-content /var/lib/wordpress/wp-content
    <Directory /usr/share/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /var/lib/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>