Articles of 虚拟主机

我如何正确configuration多个安全虚拟主机 – Apache 2.2.15和RedHat 6

首先,这个问题可能会与其他问题重叠,但我几乎觉得这是关于“如何正确configuration它”的红帽问题。 我有几个网站从同一个IP地址提供服务,没有问题。 但是,我想通过HTTPS给这些网站一些保护。 在RedHat中,ssl.conf文件是在https.conf文件中引用的,它们看起来可以很好地工作。 文档指出我要为每个我想要的安全网站创build一个.conf文件,并将该文件放在/etc/httpd/conf.d/目录中,该目录也包含ssl.conf文件。 假设所有的指令都设置正确,我是否需要引用位于该目录中的secureWesite.conf文件中的ssl.conf文件? 其次,有一个select给apache自己的密钥对,但是当涉及到每个有自己的密钥对的网站,这将如何工作? 我没有兴趣每年支付500美元的野外证书,所以有没有什么select呢? 我提到我目前只有一个IP地址。 感谢您的帮助。

SSL不适用于Apache

我试图在我的VPS上安装SSL证书。 我生成了CSR,并获得证书和中级CA. 我正在ubuntu服务器13.10上的Apache 2上工作。 所以我使用默认的SSL虚拟主机在sites-available并根据证书供应商公司指令configuration了default-ssl 。 这是我做的, <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName www.buysellswapit.com DocumentRoot /sites/bswapit <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /sites/bswapit> 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> […]

启用Apache虚拟主机站点只能通过SSL查看

通过http和https观看网站都工作,但更喜欢configuration它,以便所有访问者只通过SSL连接,以便始终以http:// www .example.com开始 – 我错过了什么? 我正在尝试执行以下操作: 请访问http://example.com并转到https://www.example.com 请访问http://www.example.com并转到https://www.example.com 请访问https://example.com并转至https://www.example.com 我在文件夹/ etc / apache2 / sites-available中创build并启用了文件名examplesite(见下文) <VirtualHost example.com:80> ServerName www.example.com ServerAlias example.com Redirect permanent / https://www.example.com/ </VirtualHost> <VirtualHost www.example.com:443> ServerName www.example.com DocumentRoot /var/www/example.com/public_html … … </VirtualHost>

Apache2 – 虚拟主机,除了将子域名设置为某个子域名之外,还可以引导所有的stream量?

我目前正在使用一个备用的子域(除www),我与Apache托pipe。 我正在努力去理解这件事情是如何工作的。 我有例如, dev.test.com和www.test.com ,这很好地工作。 我想改变它,所以如果有人去了test.com或anything.test.com他们将被定向到www.test.com 。 我尝试了以下内容: ServerAlias www.test.com *:test.com 但是,所有这些都是将所有的stream量直接传递给test.com到设置的目录位置。 这是我目前的: <VirtualHost *:80> ServerAdmin [email protected] ServerName test.com ServerAlias dev.test.com DirectoryIndex index.php DocumentRoot /var/www/test.com/dev_www/ <Directory /> Options -FollowSymLinks -Includes -Indexes -MultiViews AllowOverride None </Directory> <Directory /var/www/test.com/dev_www/> <LimitExcept GET POST> deny from all </LimitExcept> Options -FollowSymLinks -Includes -Indexes -MultiViews AllowOverride None Order allow,deny allow from […]

Apache – 如何使用每个虚拟主机的重写规则?

我已经build立了一个vHost,如下所示: <VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DirectoryIndex index.php DocumentRoot /var/www/example.com/www/ <Directory /> Options -FollowSymLinks -Includes -Indexes -MultiViews AllowOverride None </Directory> <Directory /var/www/example.com/www/> <LimitExcept GET POST> deny from all </LimitExcept> Options -FollowSymLinks -Includes -Indexes -MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> 我想添加一个重写规则如下: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteCond %{HTTP_HOST} […]

Postfix不能用@字符映射UNIX用户

我想实现的是: 在我的生产服务器上,我计划拥有多个用户和多个域,我最好的select是创build完整的email-address-format unix用户 – 当John Doe在myfirstdomain.com请求电子邮件帐户时,他应该收到他的用户名确切的电子邮件地址 – [email protected] 我该怎么办? 我创build(UNIX)用户[email protected],然后将此用户映射到电子邮件地址[email protected],因此/etc/postfix/virtual如下所示: [email protected] [email protected] 然后我贴图我的虚拟地图,重新加载configuration和发送电子邮件地址[email protected]。 我能得到什么 直接的错误说,用户john.doe不存在 – 它不计数完整的用户名[email protected] ,只有什么之前@ – 所以上面显示的映射不工作。 如何解决这个问题? 需要注意的是,当我使用没有@字符的UNIX用户时,我能够实现function。

Apache服务器上的两个应用程序使用URI

我需要在Linux上安装Apache 2.2的服务器,并且需要通过URI来区分两个VirtualHost。 但只有一个域名和一个IP地址。 而且我不能使用Alias。 我尝试过这样的事情,但这不起作用: <VirtualHost *:80> DocumentRoot /var/www/app1 ServerName localhost/app1 ServerAlias www.localhost/app1 <Directory /var/www/app1> Allow from all </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/app2 ServerName localhost/app2 ServerAlias www.localhost/app2 <Directory /var/www/app2> Allow from all </Directory> </VirtualHost> 我需要这个原因,我需要为每个虚拟主机configuration一个错误日志。 我想,我可以做一些与ServerPath的,但我不知道如何。 编辑:非常感谢你的第一个答案,它的工作:D

在什么情况下,同一台服务器上的两个相同子域的行为会有所不同?

我在同一个物理服务器上的同一个磁盘上的同一个父文件夹中有两个子域,它们在Apache2的同一个实例和所有的mod下运行。 我如何知道文件夹是相同的? 因为我这样做了: cd ~/projects/subdomain2 rm -rf * cd ../ cp -rf –preserve=all subdomain1/* subdomain2/ 我在subdomain2上有一个非常具体的问题 – 具体来说,IE拒绝维护我的团队在subdomain2中开发的webapp的会话,但是subdomain1会话在页面加载之间保持正确。 那不是在这里,也不在那里; 在这一点上,我不在乎为什么不工作,只有那个subdomain1解决这个问题…不知何故。 我问的是,为什么两个相同的目录,具有相同的.htaccess规则和相同的虚拟主机configuration,行为有所不同? 任何其他猜测什么可能会导致不一致?

VirtualDocumentRoot的dynamic子目录

我在我的开发系统上使用了VirtualDocumentRoot设置,所以我可以轻松地在多个项目上工作,而不需要随时更新VirtualHost。 目前看起来像这样: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www VirtualDocumentRoot /var/www/%1 ServerName everything.localhost ServerAlias *.localhost </VirtualHost> 所以我可以通过调用foobar.localhost访问/ var / www下面的目录。 问题是,我现在也有项目正在处理不同的文档根目录,例如在存储库中有另一个src,pub或公用文件夹,所以我想使用这些,但每个项目不同。 所以这个想法是将VirtualDocumentRoot扩展到另一个层次: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www VirtualDocumentRoot /var/www/%1/%2 ServerName sub.everything.localhost ServerAlias *.*.localhost </VirtualHost> 所以我可以使用src.foobar.localhost调用这些项目。 不幸的是,这与以前的规则冲突,所以我不能再访问没有额外的子目录的“旧”项目。 有没有办法在一个Apacheconfiguration中处理这两个VirtualHosts / VirtualDocumentRoots? 我已经有一个想法是有另一个基本的域名,如子目录localhost2,所以ServerAlias只会匹配该规则,但这不是首选的解决scheme。

子域始终redirect到主域 – Apache2 VirtualHosts&Debain

我想使用apache2 VirtualHosts来build立一个主站点和一个用于开发的子域。 这是我的site.conf虚拟主机文件的样子: <VirtualHost *:80> ServerName dev.example.com DocumentRoot /var/www/site/subdomain <Directory /var/www/site/subdomain > 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> # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel […]