如果请求来自http://xxx.domain.com , 我想能够说; DocumentRoot / home / $ {SUBDOMAIN_NAME} 以便虚拟主机的DocumentRoot将被分配给/ home / xxx 任何方式,我可以做到这一点? 感谢:D ps:请不要担心安全或这个想法有多糟糕。 为简单起见,我已经过分简化了这个问题。 实际使用情况如下: <IfModule mpm_itk_module> AssignUserId ${SUBDOMAIN_NAME} usergroup </IfModule> 将有一个unix用户与相应的子域名。
我们想要检索URL并在虚拟主机中实时使用它。 为了演示我的情况,我在ServerAdmin指令上放置了随机数字, $ ServerAdmin = int(rand(100))。“loko \ @ koko.com”; 您可能知道,只有当您重新启动服务器时,才会分配此随机数,直到另一次重新启动才会更改。 这是我们想要的:如果julie.myperl.com是请求的域名,那么$ ServerAdmin = [email protected],即实时。 希望有一个解决scheme,因为这将帮助我们删除数以千计的configuration文件,并保存我们从数千个Apache重新加载。 谢谢,Devrim 这里有一些类似的情况和解决办法, http://httpd.apache.org/docs/1.3/mod/mod_vhost_alias.html 这就是为什么要问这个问题,我们已经build立了一个API,其中的子域表示unix账户名,所以{$ user} .domain.com的variables部分必须在vhost conf中使用。 在Apache虚拟主机容器内使用variables
我的默认虚拟主机加载mainsite.com NameVirtualHost * <VirtualHost *> DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> </VirtualHost> 另一个虚拟主机我添加,所以当我去myothersite.com它将加载 NameVirtualHost * <VirtualHost *> ServerName myothersite.com DocumentRoot /var/www/myothersite.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> </VirtualHost> 我已经添加了一个logging到我的服务器IP为myothersite.com。 我重新启动Apache服务器,但myothersite.com将不会加载。 我找不到服务器。 当重新启动我得到[warn] NameVirtualHost *:0 has no VirtualHosts
在我的客户端Web服务器上,他有这个apache conf文件: rails_passenger_conf Listen *:80 <VirtualHost *:80> # rails public folder DocumentRoot /www/myclientdomain.com/public ServerName myclientdomain.com RailsEnv production </VirtualHost> 我想添加一个子域到服务器进行testing,所以我添加了一个新的configuration文件,Apache会读: my_dev_subdomain.conf Listen *:80 <VirtualHost *:80> DocumentRoot /www/dev.myclientdomain.com ServerName dev.myclientdomain.com </VirtualHost> 并使用apachectl –configtest我得到这个: [warn] _default_ VirtualHost overlap on port 80, the first has precedence (98)Address already in use: make_sock: could not bind to address [::]:80 现在,我显然不是Apache专家。 我只是一个Web开发人员,但我想我已经足够了解Webpipe理,以获得一个基本的子域运行…显然不是。 […]
林新的Apacheconfiguration,将非常高兴,如果有人帮助我以下。我运行在一个虚拟的私人服务器上的Apache,运行debian操作系统。 在/ etc / apache2 / sites-available中,我定义了两个虚拟主机site1.com.conf和site2.com.conf。 在/ etc / apache2 /网站启用,我有一个符号连接到site1.com.conf。 虚拟主机定义如下: site1.com.conf <VirtualHost *:80> ServerAdmin [email protected] ServerName site1.com ServerAlias www.site1.com site1.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www/site1 <Directory /var/www/site1> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> LogLevel warn ErrorLog /var/log/apache2/site1_error.log CustomLog /var/log/apache2/site1_access.log combined ServerSignature Off </VirtualHost> site2.com.conf <VirtualHost […]
在我的/ etc / apache2 / sites-enabled中,我有一个文件site2.com.conf,它定义了一个虚拟主机,如下所示: <VirtualHost *:80> ServerAdmin hostmaster@wharfage ServerName site2.com ServerAlias www.site2.com site2.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www LogLevel debug ErrorLog /var/log/apache2/site2_error.log CustomLog /var/log/apache2/site2_access.log combined ServerSignature Off <Location /> Options -Indexes </Location> Alias /favicon.ico /srv/site2/static/favicon.ico Alias /static /srv/site2/static # Alias /media /usr/local/lib/python2.5/site-packages/django/contrib/admin/media Alias /admin/media /var/lib/python-support/python2.5/django/contrib/admin/media WSGIScriptAlias / /srv/site2/wsgi/django.wsgi WSGIDaemonProcess site2 user=samj group=samj […]
我有一个通过Passenger(mod_rails)服务的应用程序,我想要一个规范的URL。 我想要所有的请求去http://mydomain.com (所以,重写http://www.mydomain.com到http://mydomain.com )。 在我的其他非Rails应用程序中,我使用mod_rewrite和.htaccess文件完成了以下操作: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(.+)mydomain\.com$ [NC] RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L] 但是,这似乎并不适用于Passenger。 我已经尝试了各种组合的.htaccess文件(在公共目录中),并移动指令(在虚拟主机configuration),但我不能得到这个工作。 我怎样才能做到这一点?
我有一个网站注册www.somename.com下的服务器'A' … 现在我想在一个新的服务器'B'上传文件的域名 如何开始,因为我是新的虚拟主机?
我正在尝试phpmyadmin只在域test.test.nl上启用。 而不是test2.nl。 我用下面的代码尝试这个: <VirtualHost *:80> DocumentRoot /var/www/404 </VirtualHost> <VirtualHost *:443> ServerName test.test.nl DocumentRoot /var/www/404 Alias /phpmyadmin /usr/share/phpmyadmin <Directory /usr/share/phpmyadmin> Options Indexes FollowSymLinks DirectoryIndex index.php # Authorize for setup <Files setup.php> <IfModule mod_authn_file.c> AuthType Basic AuthName "phpMyAdmin Setup" AuthUserFile /etc/phpmyadmin/htpasswd.setup </IfModule> Require valid-user </Files> </Directory> SSLEngine On SSLCertificateFile /var/www/certificates/server.pem </VirtualHost> 但是这个工作不适合我。 我也可以通过https://test2.nl/phpmyadmin访问phpmyadmin。 我只希望它为https://test.test.nl启用 我该怎么做? 汤姆 编辑:错字;)
我有一个域example.com和some-example.com的“替代”。 我试图使用nginx中的简单服务器声明来将some-example.comstream量some-example.com到example.com ,如下所示: server { listen 80; server_name some-example.com; rewrite ^/(.*) http://example.com/$1 permanent; } 我不是100%确定这是否是正确的规则,但我已经在服务器上有另一个虚拟主机,这不是问题所在,但有必要了解我遇到的问题。 server { listen 8745; server_name localhost; <other stuff goes here> } 打到<my server IP>:8745将去那个虚拟主机,按预期工作。 不过我有另外一个这样的虚拟主机: server { listen 8746; server_name localhost; <other stuff goes here> } 但是,我所有的要求<my server IP>:8746命中example.com 。 我很困惑,我没有真正感到nginx,所以任何帮助,将不胜感激为什么发生这种情况。 我在一开始就提到了这个规则,因为我认为这跟这个有关。 如果需要更多信息,我可以提供。