Articles of 虚拟主机

Apache – 如何在httpd.conf中为虚拟主机的VirtualDocumentRoot创build一个exception?

我是Apache的新手,我想知道是否有一种方法来configurationVirtualDocumentRoot为我的本地服务器上的一个虚拟主机创build一个例外。 目前,我的所有网站都存储在会议sitename.dev文件夹中。 在httpd.conf我基于服务器名称dynamic设置VirtualDocumentRoot : # get the server name from the Host: header UseCanonicalName Off LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon CustomLog /path/to/logs/access.log vcommon ErrorLog /path/to/logs/errors.log VirtualDocumentRoot /path/to/vhosts/%0 这对我的所有网站都有效,只有一个例外,其中一个站点的文档根目录应该指向exception.dev/src/php而不是exception.dev 。 根据我在这里find的答案 ,听起来好像VirtualDocumentRoot不能根据条件设置。 所以我希望我的问题可以通过设置某种别名来指向exception.dev到正确的目录来解决。 我已经尝试添加VirtualScriptAlias ,但是这阻止了Apache服务器启动: VirtualScriptAlias /path/to/vhosts/exception.dev /path/to/vhosts/exception.dev/src/php 我也尝试过与ScriptAlias和Alias相同的types,但仍然没有运气。 有什么我在这里失踪? 或者是我想要做的不可能? 任何帮助将不胜感激! 哦,如果有帮助,这是我的输出,如果我运行httpd -S : httpd: Could not reliably determine the […]

将mod_security规则限制为仅一个虚拟主机

我运行几个域(通过虚拟主机)相同的Apache安装。 有些域需要不同的mod_security规则。 在一个单独的exceptions.conf文件中,我收集了所有这些规则,并且具有以下语法: <Location "/test"> SecAuditEngine Off SecRuleRemoveById 950134 SecRuleRemoveById 981265 SecRuleRemoveById 981289 SecRuleRemoveById 981244 SecAuditEngine RelevantOnly </Location> 但是这个规则将匹配所有域的所有/testing文件夹! 但我只想限制它到一个特定的主机。 我只能在全局的exceptions.conf文件中将这些规则限制为一个虚拟主机?

虚拟DocumentRootconfiguration为WWW和非WWW – 没有redirect

我搜查了很多,但找不到答案 在Apache中设置dynamic虚拟主机时,可以这样做: RewriteEngine On # a ServerName derived from a Host: header may be any case at all RewriteMap lowercase int:tolower ## deal with normal documents first: # allow Alias /icons/ to work – repeat for other aliases RewriteCond %{REQUEST_URI} !^/icons/ # allow CGIs to work RewriteCond %{REQUEST_URI} !^/cgi-bin/ # do the magic RewriteRule ^/(.*)$ […]

如何启用组可写的suexecfunction的CGI脚本?

我被要求在我们部门的networking服务器上build立一个共享的networking空间,这个空间可以被多人访问,并且可能正在运行CGI或PHP脚本。 维护Web空间的人可能会决定使用它来提交文件,这意味着他们需要访问由脚本创build的任何文件。 我们在Scientific Linux 6上运行Apache。 由于多个人需要对Web空间进行写入访问,因此我们的标准方法是创build一个所有相关人员所属的组,然后将Web空间中的目录的权限设置为g+ws 。 suexec对分组可写的文件不满意,拒绝运行它们。 我们如何设置它,并确保任何脚本运行在不同于主要apache帐户的帐户下(并且不同于不在 web空间组中的任何用户)? 对于问责制(和其他)的原因,我宁愿不必build立一个共享的帐户,各种人将不得不用来维持这个networking空间。 对于更多的上下文,下面是我们目前的设置:我们有主目录在NFS上并且根据需要自动安装的用户。 大多数人只是使用通过mod_userdir访问他们的个人网站空间。 过去,我们通过在NFS服务器上创build额外的自动挂载目录来实现对共享web空间的多个请求,这些自动挂载目录与特定帐户无关,但其中的组拥有权设置为便于多个帐户访问。 到目前为止,这些共享空间只包含静态内容(并且我们相信所涉及的人员不会从中运行脚本),所以我们从来不必为这些空间解决任何与suexec有关的问题。 编辑 :请注意,用户可能需要访问由脚本创build的文件。

两个域(当SSL)在同一个目录下

我的apache2configuration是有问题的:我有一个服务器上的两个网站: domain1.tdl domain2.tdl 其中一个(domain2.tdl)必须是,并且可以通过端口443访问(使用SSL)。 所有的域必须是和可以通过端口80访问。但是,当我们尝试访问端口443上的domain1.tdl显示domain2.tdl文件。 因此,在端口443上,可以通过domain1.tdl 和 domain2.tdl访问domain2.tdl。 我不想要它! 我的configuration: domain1.tdl : <VirtualHost *:80> DocumentRoot /home/sites/domain1.tdl/www ServerName domain1.tdl ServerAlias www.domain1.tdl ServerAdmin [email protected] RewriteEngine on <Directory "/home/sites/domain1.tdl/www"> AllowOverride All allow from all Options -Indexes </Directory> </VirtualHost> <VirtualHost *:443> DocumentRoot /home/sites/domain1.tdl/www ServerName domain1.tdl ServerAlias www.domain1.tdl ServerAdmin [email protected] RewriteEngine on <Directory "/home/sites/domain1.tdl/www"> AllowOverride All allow from all Options […]

Apache多个IP和VirtualHosts

我有两个IP,我可以在我的linode上使用,我有三个网站运行在服务器上的所有不同的域名,其中两个也运行在SSL 这里是我的httpd.conf的相关部分(在CentOS 6.2上运行Apache2): NameVirtualHost 178.79.165.220:80 NameVirtualHost 176.58.116.80:80 NameVirtualHost 176.58.116.80:443 NameVirtualHost 178.79.165.220:443 <VirtualHost 178.79.165.220:80> ServerAdmin [email protected] ServerName domain3.com ServerAlias www.domain3.com DirectoryIndex index.php DocumentRoot /var/www/domain3.com/public_html/ LogLevel warn ErrorLog /var/www/domain3.com/logs/error.log CustomLog /var/www/domain3.com/logs/access.log combined </VirtualHost> <VirtualHost 178.79.165.220:80> ServerAdmin [email protected] ServerName domain1.com ServerAlias www.domain1.com DirectoryIndex index.php DocumentRoot /var/www/domain1.com/public_html/ LogLevel warn ErrorLog /var/www/domain1.com/logs/error.log CustomLog /var/www/domain1.com/logs/access.log combined </VirtualHost> <VirtualHost 178.79.165.220:443> ServerAdmin [email protected] […]

dynamicvariablesSetEnv vhost Ubuntu Apache2

如果这个问题已经被问到,我很抱歉。 我正在寻找一个解决scheme,使SetEnv使用%2variables。 这甚至可能吗? 我的虚拟主机: <VirtualHost *:80> ServerName dev.someuri.nl ServerAlias *.*.dev.someuri.nl VirtualDocumentRoot /home/%2/www/%1 LogLevel debug SetEnv DEVELOP_ENV dev SetEnv DEVELOP_NAME %2 </VirtualHost>

域和IP应该有不同的DocumentRoot

该域指向一个IP /服务器。 但是,如果服务器通过IP或通过域访问,我喜欢有不同的documentRoots。 所以我build立这个configuration: NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin foo@bar DocumentRoot /var/www/localhost <Directory /var/www/localhost> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin foo@bar ServerName example.org ServerAlias example.org DocumentRoot /var/www/example.org <Directory /var/www/example.org> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> 问题是访问IP或域将导致相同的页面。 我做错了什么?

添加代码为虚拟域名后,Apache 2.2服务器停止

我正在Apache 2.2本地服务器上开发一个网站。 该网站还处于发展阶段。 我想为我的网站获得一个自定义的域名,这样我就可以以“mysite.local”或其他方式访问它,而不是“localhost / xyz.php”。 经过足够的谷歌研究,我将这些行添加到httpd.conf文件中: NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> DocumentRoot “C:/Apache/htdocs" ServerName localhost </VirtualHost> <VirtualHost 127.0.0.1> ServerName the-mini-project.com ServerAlias the-mini-project.com DocumentRoot “C:/Apache/htdocs” </VirtualHost> 我还将127.0.0.1 the-mini-project.com行127.0.0.1 the-mini-project.com添加到主机文件。 这些行或其他语句的语法是否有问题? 因为我添加这些行后服务器停止运行。 当我删除它们时,恢复正常。 请帮忙。 还有其他build议吗? 谢谢。 login/ error.txt [Fri Aug 30 19:56:12 2013] [notice] Child 6676: Child process is exiting [Fri Aug 30 19:56:12 2013] [notice] Parent: […]

添加额外的主机到Apache2

我的任务是将一个现有网站的副本添加到设置中。 (作为testing环境使用) 现有的设置包括:a.mysite.com b.mysite.com c.mysite.com 我一直在试图添加d.mysite.com,但没有运气..安装程序:Debian 5.0到目前为止我所做的; 复制c.mysite.com / etc / apache2 / sites-available中的configuration文件将文件,ServerAdmin,ServerName,ServerAlias,DocumentRoot和Directory的名称重命名为指向新网站的位置。 ServerAdmin [email protected] ServerName d.mysite.com ServerAlias d.mysite.com DocumentRoot / var / www / mysite_d / php_value error_reporting 6135选项FollowSymLinks AllowOverride所有选项索引FollowSymLinks MultiViews AllowOverride所有命令allow,deny allow all 将命令a2ensite成功执行检查并validation/ etc / apache2 / sites-enabled中是否存在sym链接它链接到/etc/apache2/ sites-available中的d.mysite.com的configuration文件重新载入并重新启动Apache2 结果:新网站无法访问,Chrome提供了典型的“哎呀! Google Chrome找不到d.mysite.com' 其他信息:其他网站工作正常,例如c.mysite.com是可访问的。 我真的觉得我在这里错过了一些非常基本的东西。 提前致谢 !