Articles of 虚拟主机

有时Apache会输出PHP源代码

我的Apache服务器有一个很奇怪的问题。 我有两个文件包含<?php phpinfo(); ?> <?php phpinfo(); ?> 。 它们都放在同一台服务器上,但是在不同的虚拟主机上。 虚拟主机看起来像这样: 第一: <VirtualHost *:80> DocumentRoot /var/www/[…]/public_html ServerName something <Directory /> AllowOverride All </Directory> </VirtualHost> 第二个: <VirtualHost *:80> DocumentRoot /var/www/[…]/public_html ServerName something ServerAlias something <Directory /> AllowOverride All </Directory> </VirtualHost> 如你所见,他们几乎是平等的。 但是,如果我指向第二个虚拟主机上的phpinfo.php,源将被发送到客户端。 在第一个phpinfo被执行并显示给用户成功。 什么会导致这种差异?

apache:同一台计算机上有多个ssl虚拟主机,IP地址相同

我有一个Gentoo Linux 64位的Linux服务器。 我有Apache 2.2.17安装,我有几个虚拟主机上configuration的工作正常。 当我尝试添加SSL虚拟主机时,apache只能检测到第一个虚拟主机。 这是每个虚拟主机的configuration方式: <VirtualHost *:443> ServerName myserver serverAlias [server name].tux-in.com Include /etc/apache2/vhosts.d/magento_vhost.include ErrorLog /var/log/apache2/[server]_ssl_error_log <IfModule log_config_module> TransferLog /var/log/apache2/[server]_ssl_access_log </IfModule> SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile /etc/ssl/apache2/server.crt SSLCertificateKeyFile /etc/ssl/apache2/server.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "/var/www/localhost/cgi-bin"> SSLOptions +StdEnvVars </Directory> <IfModule setenvif_module> BrowserMatch ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 </IfModule> <IfModule log_config_module> CustomLog […]

Apache回应请求它不应该

我有以下2个域的logging website.com 10.0.0.1 www.website.com 10.0.0.1 我有(有)以下2个虚拟主机 #note how the IP address is wrong <VirtualHost 10.0.0.2:80> ServerName website.com Redirect / http://www.website.com </VirtualHost> <VirtualHost 10.0.0.1:80> ServerName www.website.com #note how there is no alias here DocumentRoot /var/www/www.website.com <IfModule mpm_itk_module> AssignUserId www-website www-website </IfModule> CustomLog /var/log/apache2/www.website.com-access.log combined ErrorLog /var/log/apache2/www.website.com-error.log </VirtualHost> <VirtualHost 10.0.0.1:443> ServerName www.website.com DocumentRoot /var/www/www.website.com <IfModule mpm_itk_module> AssignUserId […]

PHPdynamic添加虚拟主机

我正在开发一个PHP Web应用程序,除其他外,需要允许用户添加,编辑和删除Apache虚拟主机条目。 (我在我的Apache2.conf中包含一个可写的configuration文件)。 让Apache重新启动或识别vhost文件中的这些更改的最佳方法是什么? 我看到的唯一方法是以某种方式升级PHP到root权限,并在文件更新时调用“apachectl graceful”,有没有更好的方法? 我希望更改立即生效,而不是等待crontab执行….

两个域指向同一个目录(Apache)

我有两个域名 hovelgps.in quicktrack.in 我使用不同的目录在Apache中创build虚拟主机,但是当我转到第二个域时,它将redirect到第一个域目录。 我的httpd.conf : NameVirtualHost *:80 <VirtualHost *:80> ServerName hovelgps.in ServerAlias hovelgps.in DocumentRoot /var/www/hovelgps.in ErrorLog /var/www/hovelgps.in/error.log CustomLog /var/www/hovelgps.in/requests.log combined </VirtualHost> <VirtualHost *:80> ServerName quicktrack.co ServerAlias quicktrack.co DocumentRoot /var/www/quicktrack.co ErrorLog /var/www/quicktrack.co/error.log CustomLog /var/www/quicktrack.co/requests.log combined </VirtualHost>

我可以限制一个虚拟主机只有本地IP?

我有一个子域,我只想通过本地IP地址访问。 有没有可能在虚拟主机中指定这个? 我想这不是因为我没有在Google上find太多东西。 如果没有,在apache级别上做这个最好的方法是什么? 我忘记了我们正在使用的Linux版本,但是我们已经运行了Samba。 我试图限制的网站是我们网站的文档。

在Apache中将端口80更改为8080

我试图将网站使用的端口从80改为8080。 这是我的/etc/apache2/ports.conf : NameVirtualHost *:80 NameVirtualHost *:8080 Listen 80 Listen 8080 这是我的VirtualHost文件: <VirtualHost *:8080> # Admin email, Server Name (domain name), and any aliases ServerAdmin [email protected] ServerName www.foo.com ServerAlias foo.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/foo.com/ </VirtualHost> netstat -lntp输出: tcp6 0 0 :::8080 :::* […]

如何在Apache2中为VirtualHost指定ErrorDocument?

我有一个Apache 2服务器,它有几个具有类似定义的虚拟主机: <VirtualHost *:80> DocumentRoot /var/www/html/host1/ ServerName host1.loc <Directory /var/www/html/host1> AllowOverride FileInfo Options AuthConfig </Directory> ErrorDocument 404 /index.php?error=404 </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/html/host2/ ServerName host2.loc <Directory /var/www/html/host2> AllowOverride FileInfo Options AuthConfig </Directory> ErrorDocument 404 /index.php?error=404 </VirtualHost> … <VirtualHost *:80> DocumentRoot /var/www/html/hostN/ ServerName hostN.loc <Directory /var/www/html/hostN> AllowOverride FileInfo Options AuthConfig </Directory> ErrorDocument 404 /index.php?error=404 </VirtualHost> 我想自定义页面404。 […]

带有apache转发代理的2路SSL

我正在将Apache设置为使用双向SSL的客户端的正向代理。 基本stream程是myApplication – 通过http – > Apache代理 – 通过2路SSL – >客户端。 设置一切后,当我尝试启动Apache,我得到一个“不完整的客户端证书configuration为SSL代理(丢失或encryption私钥?)”错误。 我无法弄清楚的是,我在SSLProxyMachineCertificateFile指令中使用的客户端证书同时具有未encryption的私钥和公共证书。 任何build议,我失踪和/或什么我可以尝试? 一体机证书是否也需要链条? 这是我的虚拟主机的样子。 <VirtualHost *:8082> ServerName my.domain.com ProxyRequests On SSLProxyEngine On SSLProxyMachineCertificateFile /etc/httpd/keys/machine.pem SSLProxyCACertificateFile /etc/httpd/keys/machine.chain.crt ProxyPass / https://target.client.com/ ProxyPassReverse / https://target.client.com/ <Proxy *> Order deny,allow Allow from all </Proxy> </VirtualHost> 编辑:我更新了基本stream程,以澄清什么样的连接,我试图使用之间的应用程序,Apache和客户端。

mod_rewrite不添加REDIRECT_URL环境variables

我们运行一个基于Zend框架的站点,使用Apache httpd(2.2)和mod_rewrite进行SEO和可用性友好的URL:s。 最近我们添加了mod_proxy (和mod_proxy_balancer, mod_proxy_http, mod_rpaf )来设置负载均衡器虚拟主机。 我们的设置现在看起来像: external.site.com (vhost on server1.site.com with reverse proxy) |-internal1.site.com (vhost on server1.site.com) |-internal2.site.com (vhost on server2.site.com) 其中internal1和internal2服务大部分dynamic内容, external服务静态内容加上一些pipe理员types页面。 所有的虚拟主机都有相同的代码和.htaccess设置。 问题是,在external.site.com RewriteRule不会正确的头添加到请求环境,特别是我们和ZendFramework依赖的REDIRECT_URL 。 一切工作正常转发给内部虚拟主机的请求。 httpd.conf的相关部分: <VirtualHost *:80> ServerName external.site.com DocumentRoot /opt/www/htdocs/ CustomLog "/var/log/httpd-proxy-access.log" combined <Proxy balancer://backend/> Balancermember http://internal1.site.com Balancermember http://internal2.site.com ProxySet lbmethod=byrequests </Proxy> ProxyRequests Off <Proxy *> Order deny,allow […]