好, 我知道如何做虚拟主机,但在Windows上看起来很难得到我想要的。 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:/wamp/www/domaindev_com/public" ServerName domaindev.com ServerAlias *.domaindev.com ErrorLog "logs/domaindev_com-error.log" CustomLog "logs/domaindev_com-access.log" common </VirtualHost> 和我的主机文件: # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 127.0.0.1 localhost 192.168.0.1 domaindev.com 192.168.0.1 www.domaindev.com C:\Documents and Settings\B>ping domaindev.com Pinging domaindev.com [192.168.0.1] with 32 bytes of data: Reply from 192.168.0.1: bytes=32 time<1ms […]
我正在尝试在我的服务器上设置一个子域,其中blog.domain.com提供来自domain.com/blog/的内容 也许这完全是这样做的错误的方式,但我已经为此设置了一个blog.domain.com VirtualHost ,其DocumentRoot是/path-to-domain.com-root/blog/ 。 但是,即使在新的子域的VirtualHost下,原始DocumentRoot (即/path-to-domain.com-root/.htaccess )中的.htaccess文件仍然在应用中。 所以,我想知道,Apache是否会查看.htaccess文件,即使它们在DocumentRoot之上 – 如果是的话,我怎样才能阻止它做到这一点(它正在重写URL并将其发送到我不想要去)? 或者如果有更好的方法来做到这一点,我承认,我可能是一个完全白痴,完全错了:) 谢谢
有没有办法在apache2添加虚拟主机的子域名谁不存在? 现在我试试这个: <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] ServerName *.devhouse.nl DocumentRoot /var/www/errors <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/errors/> Options Indexes FollowSymLinks MultiViews AllowOverride None […]
我试图redirect多个主机名只有一个,例如,如果你input任何: foo.example.com www.example.com bar.example.com eample.com 您必须redirect到www.example.com 我已经安装了一个虚拟主机与www.example.com作为ServerName和其他作为ServerAlias,并使用mod_rewrite来检查主机名是否正确,如果不是做redirect。 问题是,一切似乎与服务器名指令主机名,所以mod_rewrite总是得到www.example.com ,这是一致的apache2文档: 例如,假设您正在为域www.domain.tld提供服务,并且希望添加指向相同IP地址的虚拟主机www.otherdomain.tld。 然后你简单地将以下内容添加到httpd.conf中: NameVirtualHost *:80 <VirtualHost *:80 > ServerName www.domain.tld ServerAlias domain.tld * .domain.tld DocumentRoot / www /域 <VirtualHost *:80 > ServerName www.otherdomain.tld DocumentRoot / www / otherdomain 您也可以在NameVirtualHost和directives中指定一个明确的IP地址来代替*。 例如,您可能想要这样做,以便在一个IP地址上运行一些基于名称的虚拟主机,并在另一个地址上运行基于IP的虚拟主机或另一组基于名称的虚拟主机。 许多服务器希望能被多个名称访问。 这可以通过ServerAlias指令放置在部分中。 例如,在上面的第一个块中,ServerAlias指令指出列出的名称是人们可以用来查看同一网站的其他名称: ServerAlias domain.tld * .domain.tld然后请求domain.tld域中的所有主机将由www.domain.tld虚拟主机提供服务 。 有没有任何apache2指令,以避免这个function,并通过它们匹配的ServerAlias的主机名获取请求服务器? 或者我必须创build另一个虚拟主机只是为了redirect? 谢谢
你好,如果这太不好意思,真抱歉。 我试图像平时一样自己find答案,但是我失败了。 当我需要分析哪些虚拟主机占用大部分系统资源时(尤其是内存),最佳做法是什么? top或ps aux似乎毫无用处,因为所有虚拟主机相关进程都在相同的apache用户下运行 怎么样的日志分析 – 这是这样的? 如果这些信息对您有任何价值,我已经为每个虚拟主机分配了访问日志。 这个问题肯定是有关系的,但并没有帮助我的问题: 通过VirtualHost跟踪Apache 如果你需要更多信息,请告诉我…我会在身边。 提前致谢。
我的设置有点尴尬。 我有http://sub.main.com映射到我的服务器的IP,但不是http://main.com 。 我在我的服务器上运行两个站点(使用不同的Web框架)。 对于这些网站中的每一个,我都在默认站点中configuration了虚拟主机,这看起来像这样。 <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName "sub.main.com" DocumentRoot "/var/www" …. </VirtualHost> <VirtualHost *:80> ServerName appsphere.djangoserver Alias /media /srv/www/appsphere/media/ …… …… WSGIScriptAlias / /srv/www/appsphere/apache/django.wsgi </VirtualHost> 现在,我怎么能让我的第二个虚拟主机第一个虚拟主机的子目录/子域。 我想使用http://sub.main.com/appsphere访问第二个网站
我只是想知道是否可以在httpd.conf中为单个VirtualHost定义几个DocumentRoot并根据访问者的IP来提供它们?
使用Amazon的Elastic Load Balancer将请求转发到使用基于名称的虚拟主机的多个EC2实例是否存在任何问题? 换句话说,HTTP头是否正确转发,以便Apache可以确定要提供哪些文件?
出于某种原因,domain1.org和domain2.org都是直接进入/ var / www有没有什么我错过了? Apache2错误日志也是干净的? 我只是不明白。 这应该是一个简单的虚拟 <VirtualHost *:80> ServerName domain1.org ServerAdmin webmaster@localhost DocumentRoot /var/www/ <Directory /var/www/> DirectoryIndex index.php Options -Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel debug CustomLog /var/log/apache2/access.log combined </VirtualHost> <VirtualHost *:80> ServerName […]
我正在尝试正确设置httpd.conf,但不pipe下面的子域/域组合,它们都parsing为相同的内部URL。 <Proxy *> Order Allow,Deny Allow from all </Proxy> ProxyRequests Off <VirtualHost *:80> Servername jira.firstfactoryinc.com ProxyPreserveHost On ProxyPass / http://localhost:8082/ ProxyPassReverse / http://localhost:8082/ </VirtualHost> <VirtualHost *:80> Servername jira.submitpatientforms.com ProxyPreserveHost On ProxyPass / http://localhost:8081/ ProxyPassReverse / http://localhost:8081/ </VirtualHost> <VirtualHost *:80> Servername mddev-jira.firstfactoryinc.com ProxyPreserveHost On ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost> 我究竟做错了什么?