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

标签 wordpress apache debian virtualhost httpd.conf

我正在尝试在我的服务器上设置一个 WordPress 网站,该网站还托管另一个网站。我只能让 WordPress 网站与网址 blog.murmilosoftware.com/wp 配合使用。

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

问题是,当我现在输入 blog.murmilosoftware.com 时,它显示的页面与 murmilosoftware.com 中提供的页面相同。

我已附加来自 /etc/apache2/sites-available 的两个可用站点配置文件。

blog.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>

murmillosoftware.com.conf

<VirtualHost *:80>
    ServerAdmin erik@murmillosoftware.com
    ServerName murmillosoftware.com
    ServerAlias www.murmillosoftware.com
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Forgot to restart my apache service. It is working now.

最佳答案

你注意到<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>

关于debian 安装上的 WordPress apache2 虚拟主机配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37233914/

相关文章:

php - 使用 mod_rewrite 更改 WordPress URL 结构,同时保持正确的 301 重定向

php - Mod_重写: How to see the variables content?

apache - 使用 Chef 在 prefork 模式下启用 apache2

Bash 脚本 : Turn on errors?

linux - 什么是 .pivot_root 文件?

node.js - pkg-config 找不到 gtk+-3.0

javascript - 我在尝试将上传媒体按钮添加到自定义元框时遇到问题

jquery - 语言切换器 - 链接更改 URL

javascript - WordPress 4.1 上的 DoJo

apache - 针对 ARM 问题交叉编译 Apache