简体   繁体   English

困惑的apache服务器虚拟主机

[英]confused about apache server virtual host

So I configured a VirtualHost in the httpd-vhosts.conf directory, but whenever I navigate to the servername, it seems to always give me the page listed in httpd.conf. 所以我在httpd-vhosts.conf目录中配置了一个VirtualHost,但每当我导航到servername时,它似乎总是给我httpd.conf中列出的页面。

I am new to apache web server and am not sure what else I need to do. 我是apache web服务器的新手,我不确定我还需要做什么。

In my httpd-vhosts.conf I have 在我的httpd-vhosts.conf中我有

NameVirtualHost *:80

#                                                                                                                                          
# VirtualHost example:                                                                                                                     
# Almost any Apache directive may go into a VirtualHost container.                                                                         
# The first VirtualHost section is used for all requests that do not                                                                       
# match a ServerName or ServerAlias in any <VirtualHost> block.                                                                            
#                                                                                                                                          
<VirtualHost *:80>
   ServerName helloworld.com
   DocumentRoot /Users/username/Desktop/RailsDemo/depot/public/
  <Directory /Users/username/Desktop/RailsDemo/depot/public/>
    AllowOverride all
    Options -MultiViews
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

In my httpd.conf, I have default settings, so I didn't change anything since install. 在我的httpd.conf中,我有默认设置,所以自安装以来我没有改变任何东西。

Also, I have matched helloworld.com to the correct ip address. 另外,我已将helloworld.com与正确的IP地址相匹配。 Typing helloworld.com into the browser produces the wrong view...it produces the view indicated in httpd.conf. 在浏览器中输入helloworld.com会产生错误的视图...它会生成httpd.conf中指示的视图。

If this helps, I am trying to do p. 如果这有帮助,我试图做p。 238 of Pragmatic Agile Web Development with Ruby on Rails (4th Edition) -- Iteration K1: Deploying with Phusion Passenger and MySQL 使用Ruby on Rails进行实用的敏捷Web开发(第4版) - 迭代K1:使用Phusion Passenger和MySQL进行部署

Any help would be appreciated, thanks! 任何帮助将不胜感激,谢谢!

You seem to be running Mac OS X. In your httpd.conf, you will have the lines; 您似乎正在运行Mac OS X.在您的httpd.conf中,您将拥有这些行;

# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf

Remove the comment, making it 删除评论,制作它

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

Restart apache, and that should activate your named vhost. 重启apache,这应该激活你的命名vhost。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM