这里基本上是我想要做的: http请求进来后,路由器中的前端将其发送到本地networking(服务器A)中的服务器, 服务器识别虚拟主机的请求 服务器a具有该虚拟主机的重写规则,该规则重写请求以将其发送到位于同一本地networking上的服务器B 服务器B获取请求,识别虚拟主机并根据虚拟主机设置设置文档根目录 它一直运行到服务器B,请求总是以默认定义结束。 这可能吗? 我正在运行Debian Wheezy。 服务器apacheconfiguration文件/etc/apache/sites-enabled/wiki <Directory /var/lib/shared/websites/wiki/www> Options None AllowOverride All Order allow,deny Allow from all </Directory> <VirtualHost *:80> ServerName wiki ServerAlias wiki.asus.local ServerAlias wiki.mydomain.net DocumentRoot /var/lib/shared/websites/wiki/www CustomLog /var/lib/shared/websites/wiki/log/access.log combined ErrorLog /var/lib/shared/websites/wiki/log/error.log RewriteEngine on RewriteRule ^/(.*) http://192.168.10.91/$1 [P,L] </VirtualHost> 服务器B apacheconfiguration文件/etc/apache/sites-enabled/wiki <Directory /var/lib/shared/websites/wiki/www> Options None AllowOverride All Order allow,deny Allow […]
所以这里是我想要做的基础。 我有2个服务器,一个现场和一个开发。 Live有2个域名连接到它。 为了简单起见,我们将把它们称为a.live.com和b.live.com。 开发者有一个公共的IP地址,但是没有附加主机。 所以我可以访问开发11.22.33.44,但我实际上不能使用主机名来访问它。 (域显然只指向活服务器) 我刚刚创build了开发服务器,但是我无法访问这两个子域。 我的机器上有一个主机文件设置,指向主机的域名: 11.22.33.44 a.live.com 11.22.33.44 b.live.com 我启用了这两个站点(它们都出现在/ etc / apache2 / sites-enabled),但是由于某种原因,每当我去b.live.com它尝试访问我的开发服务器中的a.live.com。 所以我知道主机正确指向正确的服务器。 此外,当我禁用a.live.com然后b.live.com正确去到正确的子域。 所以它看起来好像阿帕奇以某种方式采取我所投入的任何领域,并以某种方式sorting他们想要的顺序…这是我的虚拟主机文件的一个例子 <VirtualHost *:80> ServerName a.live.com DocumentRoot /var/www/a/ <Directory /> Options FollowSymLinks AllowOverride all </Directory> </VirtualHost> b虚拟主机文件是完全一样的,但有明显的变化。 一些额外的注意事项:开发使用Apache 2.4,而实际使用2.2这就是为什么我不能只复制和粘贴的东西= /(我们计划最终推到2.4,但我们首先想运行一个开发服务器,并确保一切正常正确) 任何帮助将不胜感激。 我不熟悉Apache重写,所以不知道我是否做错了什么。 我已经做了一些关于服务器故障的search,以下是一些常见问题的答案:我跑了 apachectl restart 改变了一切后。 (从我所知道的优雅有时会错过的东西,所以我做了一个完全重启,而不是)我也跑了configtest,它说,语法是好的 先谢谢你。
系统:ubuntu 14.04作为VPS,apache 2.4.7 我有几个虚拟主机设置,听:80和:443端口。 如果我apache2ctl -S它显示不正确的虚拟主机作为端口80上的默认。事实上,如果我浏览到http://default.com ,我从另一个虚拟主机获取内容:一个Apache指定为默认,但shouldn (客户.com)。 我的设置有什么问题? 我启用的网站是: default.com customer.com apache2ctl -S VirtualHost configuration: *:80 is a NameVirtualHost default server customer.com (/etc/apache2/sites-enabled/customer.com.conf:1) port 80 namevhost customer.com (/etc/apache2/sites-enabled/customer.com.conf:1) port 80 namevhost www.customer.com (/etc/apache2/sites-enabled/customer.com.conf:19) port 80 namevhost www.default.com (/etc/apache2/sites-enabled/default.com.conf:36) port 80 namevhost tools.default.com (/etc/apache2/sites-enabled/default.com.conf:41) port 80 namevhost phpmyadmin.default.com (/etc/apache2/sites-enabled/default.com.conf:57) *:443 is a NameVirtualHost default server […]
我正在尝试将虚拟主机添加到我的Apache中,但是我正在试图以特定的方式执行,而我不知道它是否可行。 我现在有这样的: <VirtualHost *:80> ServerName til.local DocumentRoot "C:/xampp/htdocs/til" <Directory "C:/xampp/htdocs/til"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> 其中,“直到”是“域名”的文件夹的名称。 我想设置一次,所以我不需要再看了,即使在向htdocs文件夹添加新文件夹时也是如此。 我将在短时间内创build许多不同的域名,所以我不想每次添加虚拟主机时都要进入apache设置。 是否有可能设置的东西,所有文件夹中的htdocs自动成为这样的域名? 所以如果我把ABC作为一个文件夹,它使用“abc.local”和文件夹“htdocs / abc”?
我曾计划将网站迁移到另一台服务器, 所以复制代码和数据库等,并改变我的主机文件在Windows上,一切工作几乎如预期。 我可以加载网站,并重新使用域名之前将其用于testing, 然而,有一个function,使用PHP库,在HTML代码中find图像url。 正因为如此,我必须使用外部http url来访问图像,即使图像在同一台服务器上。 我的问题, 即使网站上的其他所有内容都使用新的本地服务器,但这段代码仍在查看活动服务器,就好像没有为其设置虚拟主机设置一样。 在我的/etc/sites-enabled/example.conf我有一个虚拟主机设置… <VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DirectoryIndex index.php DocumentRoot /var/www/html/example ScriptAlias /cgi-bin /var/www/html/example/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> ErrorLog /var/www/html/example/error.log CustomLog /var/www/html/example/access.log combined </VirtualHost> 这正如预期的那样工作,如上所述的一个问题,似乎在这种情况下忽略它。 如果我更改了该域的实际Alogging,我将确信这将工作,但我需要先testing它。 编辑:只是为了澄清更多, 我在Ubuntu上使用Apache2。 我的核心问题是, 当我的php代码与一个图像的URL,例如<img src="http://www.example.com/myimage.jpg" /> ,为什么只有在一个特定的情况下,它是从REAL服务器加载这个图像该域指向,而不是像其他所有的本地服务器?
我试过寻找这种情况,但似乎无法find完全这个设置。 我想有以下几点: 我想有两个子域名redirect到不同的文档根目录不同的https网站。 我们拥有的SSL证书是域级(* example.com)。 以下似乎没有工作,因为当我为每个端口放置多个虚拟主机时,我得到“此网页不可用”。 有什么build议么? NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> ServerName subdomain1.example.com RedirectPermanent / https://subdomain1.example.com </VirtualHost> <VirtualHost *:80> ServerName subdomain2.example.com RedirectPermanent / https://subdomain2.example.com </VirtualHost> <VirtualHost *:443> DocumentRoot /srv/www/subd1/ ServerName subdomain1.example.com # more directives </VirtualHost> <VirtualHost *:443> DocumentRoot /srv/www/subd2/ ServerName subdomain2.example.com # more directives </VirtualHost> 我们有DNS将subdomain1.example.com和subdomain2.example.com指向我们的服务器IP地址。 编辑 :修正了示例configuration错误(没有ServerName指令),并添加了有关我们的DNS的信息。
我在apache2服务器上configuration了Vhost: <VirtualHost *:80> ServerAdmin [email protected] ServerName www.asr.lan DocumentRoot /home/web/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/web/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, […]
我的CentOS服务器有几个IP地址。 在apache上,每个IP地址都configuration了不同的虚拟主机。 当我通过PHP / sendmail发送邮件时,我希望sendmail使用与在/ etc / hosts文件中configuration的IP相匹配的主机名。 那可能吗?
我最近把我的网站转移到一个新的服务器上,一些用户的DNS服务器还没有更新。 同时我想提供给他们一个IP地址来访问我的网站。 我在我的000-default.conf文件中设置了一个别名,以便http://(ip地址)/别名进入我的博客的主页,但是当然所有的链接仍然指向域名,所以尽快任何人点击一个链接,他们被带到旧的服务器了。 无论如何要重写这些url,以便有可能浏览和使用该网站,而访问它通过一个IP地址和别名,而不是域名?
我正在运行两个docker集装箱,使用下面的dockercomposer php脚本: db: image: cofoundry/mysql environment: – MYSQL_USER=wordpress – MYSQL_PASS=wordpress – MYSQL_DB=wordpress ports: – "3306:3306" privileged: true web: image: cofoundry/nginx-phpfpm volumes: – ../bedrock:/app environment: – DOCROOT=/app/web links: – db ports: – "80:80" privileged: true 但是我找不到任何地方,我怎么能为不同的网站运行多个nginx-phpfpm web和mysql容器,比如web_1 – db_1,web_2 – db_2等。 另外我更改了/ etc / hosts文件以使用boot2docker ip列出所需的所有域,但是如何为它们运行容器? 我不能在相同的端口80和3306上运行容器。 请指教,谢谢!