[英]Wordpress apache2 virtual host configuration on a debian install
I'm trying to setup a wordpress site on my server that also hosts another website. 我正在尝试在我的服务器上设置一个wordpress网站,该网站还托管另一个网站。 I can only get the wordpress site to work with the web address blog.murmilosoftware.com/wp
. 我只能使用wordpress网站来处理网址blog.murmilosoftware.com/wp
。
I want to be able to simply access it from blog.murmilosoftware.com
. 我希望能够从blog.murmilosoftware.com
简单地访问它。
The problem is when I type blog.murmilosoftware.com
in right now it displays the same page that is available from murmilosoftware.com
. 问题是,当我输入blog.murmilosoftware.com
,它会显示与murmilosoftware.com
相同的页面。
I have attached both of the sites-available config files from /etc/apache2/sites-available
. 我已经从/etc/apache2/sites-available
附加了两个站点可用的配置文件。
blog.murmillosoftware.com.conf 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 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. 忘了重启我的apache服务。 It is working now. 它现在正在运作。
Do you notice the <VirtualHost *:80>
in your murmillosoftware.com.conf
file? 您是否注意到murmillosoftware.com.conf
文件中的<VirtualHost *:80>
? That is called the Virtual Host configuration. 这称为虚拟主机配置。 In your current blog.murmillosoftware.com.conf
, all you're doing is creating an alias to /wp
path, which is why you're able to browse wordpress there. 在您当前的blog.murmillosoftware.com.conf
,您所做的只是创建/wp
路径的别名,这就是您可以在那里浏览wordpress的原因。
Update your blog.murmillosoftware.com.conf
as follows (might be buggy, keep checking server logs): 更新您的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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.