Articles of 虚拟主机

如何使用基本身份validation来保护在Apache2虚拟主机中反向代理的Tomcat web应用程序?

我很难弄清楚如何添加基本的HTTP身份validation来密码保护生产Web服务器上运行的开发testing环境。 主站点和testing环境都是使用AJP代理服务Tomcat webapps的单独实例的虚拟主机。 我们需要阻止公众访问testing环境,而不必在Tomcat环境中对web.xml进行更改,而使用Apache而不是Tomcat来实现保护。 然而,虚拟主机中的ProxyPass和ProxyPassReverse指令似乎覆盖了使用.htaccess或者放在<Directory>控制块中的任何东西,而似乎我不能在<VirtualHost>控制的主体中使用像AuthType这样的指令阻止旁边。 我对Apache(或Tomcat)并不是非常有经验,也不确定哪些指令可以应用于何处,哪些可能会覆盖其他指令。 由于需要在生产服务器上进行更改,因此我不敢轻易尝试,以免造成停机。 httpd.conf本身非常简单: LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so LoadFile /usr/lib/libxml2.so 相关的虚拟主机文件/ etc / apache2 / sites-available / dev443如下所示: <IfModule mod_ssl.c> <VirtualHost dev.mydomain.com:80443> ServerName dev.mydomain.com:80443 ServerAdmin webmaster@localhost DocumentRoot /var/www/dev ProxyPass / ajp://127.0.0.1:8010/ ProxyPassReverse / ajp://127.0.0.1:8010/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/dev/> Options Indexes FollowSymLinks MultiViews AllowOverride All […]

使用SSL的Apache虚拟主机

我有一个完全的根访问,其中承载3个域的Web服务器。 它们位于相同的IP上,并通过运行apache2的VirtualHost文件进行pipe理。 我想向其中的一个添加SSLfunction,即能够通过https://example.com访问同一个站点 我已经尝试了我在网上find的所有东西,但其中大部分都会导致apache根本没有提供任何内容。 我会很高兴有关如何configuration我的系统来支持这一点的任何帮助。 谢谢, 通恰伊

我如何让我的Apache虚拟主机工作?

我试图为本地开发build立虚拟主机,似乎无法得到它的工作。 我在我的httpd.conf中有这个: NameVirtualHost * <VirtualHost *> ServerName localhost DocumentRoot C:/Users/Elliot/dev/UniServer/www </VirtualHost> <VirtualHost *> ServerName drupal.dev DocumentRoot C:/Users/Elliot/dev/UniServer/www/drupal.dev/httpdocs </VirtualHost> 这在C:\ Windows \ System32 \ drivers \ etc \ hosts中: 127.0.0.1 localhost 127.0.0.1 drupal.dev http://localhostparsing成功, http://localhost //drupal.dev/不。 任何想法欢迎… 编辑:我敢肯定,我的主机文件是潜在的问题,任何编辑被忽略。 奇怪的是,我可以编辑,保存和删除它没有提升的权限,这不应该在Windows> = Vista的情况下。 我正在通过“什么可以导致DNS查找忽略主机文件条目?”,“被忽略的HOSTS文件”和“在Windows XP中的主机文件的问题(作为新用户,我不能张贴链接)。 编辑:在我的情况下,停止DNS客户端服务解决了问题…. 编辑:…但只是非常简短。

Apache中的dynamic虚拟主机

我的httpd-vhosts.conf文件如下所示: <VirtualHost *:80> DocumentRoot "/www/foo/htdocs" ServerName foo </VirtualHost> <VirtualHost *:80> DocumentRoot "/www/bar/htdocs" ServerName bar </VirtualHost> <VirtualHost *:80> DocumentRoot "/www/baz/htdocs" ServerName baz </VirtualHost> 注意模式? 有没有办法减less重复,或者我坚持有一个单独的VirtualHost条目为每个网站?

Apache虚拟主机和反向代理

我有许多虚拟主机的域名映射到一个单一的Apache服务器(我们称之为server1)。 在某些情况下,某个虚拟主机的所有URL应该由不同的服务器来服务(我们称之为server2)。 什么是最简单的方法来实现呢? 我可以简单地将server2设置为使用与server1相同的基于名称的虚拟主机设置,然后依靠server1的X-Forwarded-Host头(即server2是否只根据这些头进行正确的操作)? “同名虚拟主机设置”是指“真正的”域名(即映射到server1的IP的域名)。

混合的IP和名字为基础的虚拟主机与Nginx

我build立了许多域,但我不知道如何configuration,如果只有IP地址给出。 说foo.com我有一个设置去web / foo.com / htdocs,我想把88.99.66.55这个ip地址像一个域名到web / fook.com / htdocs server { listen 80; server_name 85.99.66.55; location / { root /home/web/fook.com/htdocs; } location ~ \.(php|php3|php4|php5)$ { root /home/web/fook.com/htdocs; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } } 导致 [warn]: conflicting server name "85.105.65.219" on 0.0.0.0:80, ignored

如何禁用Apache的主服务器function?

这个文件说这个 Due to the fact that www.example1.com is first in the configuration file, it has the highest priority and can be seen as the default or primary server. That means that if a request is received that does not match one of the specified ServerName directives, it will be served by this first VirtualHost. 我怎么能禁用这个,我不希望Apache的服务任何文件,如果任何启用的虚拟主机不匹配?

如何在一台服务器上处理主站点和多个虚拟主机

我有一个标准的Ubuntu安装。 Apache web根目录是/ var / www。 我想主办我的“主要”网站和一些其他人。 通常我会把mysite.com的文件放在web根目录下。 但是,如果我想承载多个网站,似乎可能会变得混乱。 看来,我最终会得到一个像这样的结构: 我的“主”网站的文件: /var/www/index.html /var/www/images/ /var/www/js/ 等等… 然后我的虚拟网站如: /var/www/somesite/ #somesite's files in here /var/www/foobar/ #foobar's files in here 我应该如何组织这样的设置? 将主站点的文件与虚拟主机站点的目录混合似乎是错误的和混乱的。 我想把我的“主”网站放到webroot的自己的目录(如上面的“somesite”和“foobar”),但是访问我的IP地址的人会得到没有任何站点文件的web根目录。 我应该这样做,然后将任何东西redirect到主要的IP到“主”网站的目录? 也许与htaccess? 也许在某个地方的apacheconfiguration? 你将如何处理这个? 我最终做了什么 (感谢下面的build议,所有这些都很有帮助)… 以下是configuration文件( /etc/apache2/sites-enabled/default )最初的内容: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www> Options Indexes […]

有一个命令让Apache从内存中显示其运行configuration?

有没有办法让Apache Web服务器从内存中显示它的当前运行configuration,即不是通过parsingconfiguration目录中的文件? 我刚刚设法意外覆盖了服务器上的虚拟主机configuration(是的,我知道应该有一个备份!),而我可以很容易地重build它(非常新的服务器,这么简单的configuration,因此没有备份但是 – 这是明天的任务),想知道是否有任何方法让Apache显示其实时运行的configuration,而不仅仅是parsing文件(如httpd -S似乎这样做)。 尝试谷歌search和在这里searchServerFault,但没有发现任何东西。 我可以想象,随着时间的推移,这可能会节省一些人的培根。 🙂

nginx默认所有的请求,应该是一个虚拟主机

我有我的服务器上的nginx设置与以下configuration文件 worker_processes 2; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; access_log logs/mysite.access.log; error_log logs/mysite.error.log; gzip on; gzip_min_length 1100; gzip_buffers 4 8k; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 75 20; server { listen 80; server_name website.com www.website.com; location / { include proxy.conf; proxy_pass http://127.0.0.1:5000; proxy_redirect default; if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)$") { […]