我最近从Ubuntu转移到Fedora。 我现在希望自己能够做得更早,因为我意识到我对Linux的了解并不像我应该做的那么多–Ubuntu对我隐瞒了很多。 以前在Ubuntu上,我有几个虚拟主机指向我的用户的主目录中的目录: /home/foo/Code/PHP/somedir/ 这是一个虚拟主机: <VirtualHost *:80> DocumentRoot /home/foo/Code/PHP/somedir <Directory /home/foo/Code/PHP/somedir/> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> ServerName database.dev </VirtualHost> 我已经在我的hosts文件中设置了database.dev 。 我到目前为止所做的:在将虚拟主机添加到/etc/httpd/conf.d/database.dev.conf – 这是正确的地方吗?),我重新启动了Apache。 我收到了一些SELinux警告,并使用Fedora附带的工具对它们进行了疑难解答。 在重新启动Apache或在浏览器中查看http://database.dev/ ,我不再获得SELinux警告。 但是,我仍然得到403错误。 在DocumentRoot for database.dev ,我创build了一个名为“hello.txt”的文件,我试图在浏览器中访问它。 玩文件权限和所有权没有任何作用。 这里是错误日志的一个片段: [Sat Dec 31 20:20:34 2011] [error] [client 127.0.0.1] (13)Permission denied: access to /hello.txt denied […]
我有我的Apache上的2个虚拟主机的以下configuration: www.domain.com和res.domain.com 。 第一个是开放第二个是仅限注册用户。 <VirtualHost *:80> ServerName www.domain.com DocumentRoot /website/www <Directory "/website/www"> Options FollowSymLinks AllowOverride All RewriteEngine On RewriteCond %{REQUEST_URI} !api/dispatch\.php$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^api/.*$ api/dispatch.php [L,QSA] </Directory> </VirtualHost> <VirtualHost *:80> ServerName res.domain.com DocumentRoot /website/res <Directory "/website/res"> Options FollowSymLinks AllowOverride All AuthType Basic AuthUserFile /website/res/users.sec <Limit GET POST> Require valid-user </Limit> </Directory> </VirtualHost> 我想所有的电话http://res.domain.com/api/ […]
我想在RewriteRule使用VirtualDocumentRoot设置的值。 Apache 文档说: 另外要确定的是文档根目录(使用DocumentRootconfiguration,并通过DOCUMENT_ROOT环境variables可用于CGI脚本)。 在一个正常的configuration中,核心模块在将URI映射到文件名时被这个模块使用,但是当服务器被configuration做dynamic虚拟主机时,这个作业必须被另一个模块(mod_vhost_alias或者mod_rewrite)接pipe,做映射的方法。 这两个模块都不负责设置DOCUMENT_ROOT环境variables,所以如果有任何CGI或SSI文档使用它,它们将会产生一个误导性的值。 参考文档,似乎我将无法在RewriteRule使用%{DOCUMENT_ROOT} 。 但是在寻找替代解决scheme后,我发现这个票据 (标题: DOCUMENT_ROOT环境variables用VirtualDocumentRoot设置不正确 )说它已经被“2.4.1修复”了。 我正在使用最新(稳定)版本的Apache: $ httpd -v Server version: Apache/2.4.9 (Unix) Server built: Jun 18 2014 03:07:48 …但似乎并不适合我。 testing时, %{DOCUMENT_ROOT}具有httpd.conf中由DocumentRoot设置的默认值。 我想通过VirtualDocumentRootdynamic设置%{DOCUMENT_ROOT} (或任何其他我可以使用的variables)。 这里是我想在httpd-vhosts.conf中使用的: <VirtualHost *:8080> ServerName dev ServerAlias *.dev VirtualDocumentRoot "/usr/local/var/www/.dev/%-2+" RewriteRule ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000%{DOCUMENT_ROOT}/$1" [P] </VirtualHost> 有解决scheme吗?
我有以下设置,用于自动生成在/etc/apache2/apache2.conf(在Debian 7.0上运行)中configuration的子域/虚拟文档根目录。 <VirtualHost *:80> ServerAlias * UseCanonicalName Off VirtualDocumentRoot /home/%2/htdocs/%1 # Setup correct (virtual) document root as $_SERVER['DOCUMENT_ROOT'] for PHP php_admin_value auto_prepend_file /home/jbraun/setdocroot.php <Directory /home/%2/htdocs/%1> Options Indexes MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.html index.php # These lines don't work AuthType Basic AuthName "HALMA" AuthUserFile /usr/local/apache/passwd/passwords Require valid-user # Commented for […]
我创build了一个小脚本在我的服务器上添加网站,它看起来像这样: #!/bin/bash echo "<VirtualHost *:80> ServerAdmin [email protected] ServerName $1 ServerAlias www.$1 DocumentRoot /var/www/$1/public_html ErrorLog ${APACHE_LOG_DIR}/error-$1.log CustomLog ${APACHE_LOG_DIR}/access-$1.log combined </VirtualHost>" > /etc/apache2/sites-available/$1.conf mkdir /var/www/$1 mkdir /var/www/$1/public_html/ a2ensite /etc/apache2/sites-available/$1.conf 这工作正常。 我可以运行这个脚本作为./newsite example.com ,我得到我的文件example.com.conf下sites-available和一切。 但是当我运行a2ensite ,我有以下错误: ERROR: Site /etc/apache2/sites-available/example.com does not exist! 这很奇怪,因为即使在我仍然得到这个错误之前,我创build了一个名为example.com.conf的文件。 有任何想法吗? 这是一个错误? PS:只要sudoers就可以运行这个脚本。
我注意到Apache的一个非常奇怪的问题。 我有很多虚拟主机 – 大约是501。 第493号主机出现问题。首先493个主机按预期工作,但是一旦我添加第494号主机,PHP就停止与memcache通信,并且每次读写访问都会超时。 其实,我使用memcache作为后端会话存储,所以,PHP函数: session_start(); 在30秒后简单地超时。 如果我删除了494个虚拟主机中的随机虚拟主机,并重新启动apache,它将重新开始工作。 我已经确定ulimit非常高(65k),但它没有帮助。 我已经尝试彻底closuresulimits,但没有运气。 你们有什么想法还有什么我可以尝试? 我已经尝试了在连接到浏览器的httpd进程之后,等待30秒后再开始。 这是strace输出: select(1170, [1024 1169], [], NULL, {1, 0}) = 2 (in [1024 1169], left {0, 999998}) select(1170, [1024 1169], [], NULL, {1, 0}) = 2 (in [1024 1169], left {0, 999998}) select(1170, [1024 1169], [], NULL, {1, 0}) = 2 (in [1024 […]
使用IPv4时,推荐的虚拟主机types是基于名称的,因为您只需要一个IPv4地址。 基于IP的虚拟主机只能在基于名称的情况下使用(例如由于TLS) 使用IPv6,不需要保存地址。 使用基于IP的虚拟主机代替基于虚拟主机的虚拟主机不是更好吗? 什么可能是使用基于名称的虚拟主机与IPv6的原因?
我正在使用Apache 2.4.6构buildRHEL7环境,我需要为几个用户设置几个虚拟主机(假设每个UID有一个虚拟主机)。 在过去的两天里,我读了几乎所有与MPM和虚拟主机configuration相关的东西。 但我还是有一些疑问: 是mpm-itk唯一能够处理多个UID / GID的MPM,以每个虚拟主机的angular度设置选项? 因为它不是基于RHEL的发行版本身,是否可以在不安装mpm-itk的情况下实现相同的目的? 如果是,如何? 如果没有:是否可以/安全地在RHEL 7上安装mpm-itk? 不知道这是一个愚蠢的问题。 我希望你能帮助我。
$HTTP["host"] == "example.com" { server.document-root = "/var/www/vhosts/example.com/httpdocs/development/api" server.errorlog = "/var/log/lighttpd/error.log" accesslog.filename = "/var/log/lighttpd/access.log" } $HTTP["host"] == "api.example.com" { server.document-root = "/var/www/vhosts/example.com/httpdocs/development/api" server.errorlog = "/var/log/lighttpd/error.log" accesslog.filename = "/var/log/lighttpd/access.log" } $HTTP["host"] == "example.org" { server.document-root = "/var/www/vhosts/example.com/httpdocs/development/services" server.errorlog = "/var/log/lighttpd/error.log" accesslog.filename = "/var/log/lighttpd/access.log" } 以上是我的lighttpd.conf的摘录。 example.com和example.org工作正常。 任何想法为什么api.example.com拒绝工作? 谢谢!
我的networking服务器上的SVN似乎已经打破了,我做了一些改变。 它被configuration为一个HTTPS虚拟主机的一部分,不是普遍可访问的。 我的SVN客户端给出错误'禁止访问(回购)',但是如果我通过Web界面(SVNListParentPath打开),一切工作正常,使用相同的URL。 我甚至可以通过浏览器访问这些文件。 当我使用客户端时,我注意到我的Apache日志表明当我的SVN存储库位于'/ home / svn'下时,客户端正试图访问'/ var / www / mysite / svn'。 在使用Elinks进行故障排除时,我得到了一个redirect页面,所以这可能意味着我的服务器使用某种redirect,这对SVN客户端来说是失败的。 网站的其他部分通过SSL正常工作,只是SVN不起作用。 谢谢。 这里是我的这个网站的Apacheconfiguration: #mydomain.co.uk NameVirtualHost *:443 <VirtualHost *:80> ServerAdmin [email protected] ServerName mydomain.co.uk DocumentRoot /var/www/mydomain <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/mydomain> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <Directory /usr/share/ampache> RewriteEngine On […]