Articles of 虚拟主机

将VirtualHostredirect到内部IP地址并使用密码进行保护

我在家里的networking上运行一个服务器,可以从外面使用。 我的家庭networking中还有另外一台设备,它提供了一个相当不安全和不可靠的networking服务器,我仍然希望从外部访问,但采用更安全的方式。 我可以在我的路由器上为这个特定的设备build立一个端口转发规则,但我不喜欢这个想法。 所以我认为有可能通过使我的web服务器以安全的方式从外部redirect到这个内部IP来解决这个问题。 我目前的虚拟主机configuration包含这个片段: <VirtualHost *:443> ServerName my-server.tld ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log ProxyPass / http://192.168.2.20/ ProxyPassReverse / http://192.168.2.20/ </VirtualHost> 但它不起作用。 我还想通过添加身份validation来使其更安全,因为可以使用.htaccess为目录提供身份validation。 这怎么能实现? 还是有更好的方法来安全地将设备从内部功课暴露给外部?

Web服务器显示IP地址而不是域名

我正在CentOS 7上运行一个Web服务器(Apache2)。我有以下虚拟主机文件。 该网站正在服务,因为它应该。 但是,URL在浏览器(任何浏览器)中从域名verizondecom.com更改为服务器的IP地址。 什么需要改变,使URL是域名而不是服务器的IP? NameVirtualHost *:80 <VirtualHost *:80> ServerName www.verizondecom.com ServerAlias verizondecom.com ErrorLog /var/log/httpd/verizondecom.err CustomLog /var/log/httpd/verizondecom.log combined DocumentRoot /var/www/www.verizondecom.com/public SetEnv ENVIRONMENT "production" <Directory "/var/www/www.verizondecom.com/public"> AllowOverride ALL Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>

HTTPD VirtualHostconfiguration无法正常工作

得到了一个新的VPS,安装了一切,有时间来设置虚拟主机 #vim /etc/httpd/conf.d/project.conf <VirtualHost *:80> DocumentRoot "/var/www/html/project.net/wordpress" ServerName project.net ServerAlias www.project.net Options -Indexes +FollowSymLinks +MultiViews </VirtualHost> 要求所有授权在主httpd文件中设置。 #systemctl restart httpd project.net是可访问的,但显示默认的httpd页面 系统信息: Linux dev 2.6.32-042stab116.2 #1 SMP Fri Jun 24 15:33:57 MSK 2016 x86_64 x86_64 x86_64 GNU/Linux with Apache/2.4.6 (CentOS) Server built: Oct 19 2017 20:39:16

具有通配符域名子域的虚拟主机。*

我正在尝试在Apache上设置对某些子域名作出反应的虚拟主机,而不是任何域名 如 subxdomain。* 所以任何指向机器和子域的域都可以工作 ServerName web。* … 所以web.blahblah.com以及web.mooose.com将工作(* .blahblah.com和* .mooose.comparsing到同一台机器)

apache2强制代理子网域上的特定url

我有一个网站,使用mod_rewritedynamic虚拟子域,如下定义: <VirtualHost *:80> ServerName example.com ServerAlias *.example.com DocumentRoot /var/www/example.com/www RewriteEngine on RewriteCond %{HTTP_HOST} ^[^.]+\.examle.com$ RewriteRule ^(.+) %{HTTP_HOST}$1 [C] RewriteRule ^([^.]+)\.example.com(.*) /var/www/example.com/$1$2 </VirtualHost> 问题是,我想要一个特定的url,说subdomain.example.com/CONTROL/指向www.example.com/使用代理(而不是URLredirect)。 我曾尝试添加: RewriteRule ^([^.]+)\.example.com/CONTROL(.*) /var/www/example.com/www$2 [P] 但是这没有用。 有任何想法吗?

有没有一个后缀mysql的virtual_maps append_at_origin解决方法,所以我可以pipe道外部脚本?

我正在使用虚拟域,我想设置服务器别名到自定义脚本。 我pipe理所有帐户使用后缀映射到MySQL。 看来postfix会自动附加一个虚拟域,而不pipe转发/别名结果如何返回。 所以即使我有: "|/bin/command" 后缀正在读取它: "|/bin/command"@mydomain.com 有没有解决办法,或设置我可以修复? 这似乎比append_at_myorigin=no理想的,但根据文档不支持。 另一个select,也许我可以完全跳过虚拟别名,并使用“/ etc / postfix / aliases”表 – 假设所有电子邮件都转到主域。 我会尝试这个,但如果有人有任何其他的想法如何使它与虚拟域的工作,请让我知道,因为这将是非常有用的! 谢谢。

虚拟主机中的通配符与dynamic日志?

我的Apache虚拟主机configuration目前有几个重复; <VirtualHost *:80> ServerName example1.com ServerAlias www.example1.com DocumentRoot /home/example1.com/www LogLevel warn ErrorLog /home/example1.com/logs/error.log CustomLog /home/example1.com/logs/access.log combined Alias /dev /home/example1.com/dev ScriptAlias /cgi-bin/ /home/example1.com/cgi-bin </VirtualHost> 怎么会改变,所有的'example1.com'实例被replace为用户当前正在查看的任何域? 我知道mod_vhost_alias ,但是我没有看到任何提及能够dynamic地执行日志或别名(除了ScriptAlias之外)。 有没有办法做到这一点? 我宁愿不牺牲这个单独的日志。

虚拟主机无法从同一networking上的其他计算机访问

我已经在一台机器上创build了一个虚拟主机并重新加载了apache,但似乎无法从同一networking上的另一台计算机访问它。 (当我设置服务器的IP和另一台机器的主机文件时,它工作) 使虚拟主机我编辑/etc/httpd/conf/httpd.conf并添加: <VirtualHost 192.168.0.1:80> DocumentRoot /home/sites/mysite ServerName mysite.test.corp ErrorLog logs/mysite.test.corp-error_log CustomLog logs/mysite.test.corp-access_log common <Directory /home/sites/mysite> AllowOverride All </Directory> </VirtualHost>

设置Apache重写规则,只在目录中转发

我目前有一个在httpd.conf中的以下站点设置: <VirtualHost xxxx:80> ServerName testsite ExpiresActive On ExpiresByType image/gif A2592000 ExpiresByType image/png A2592000 ExpiresByType image/jpg A2592000 ExpiresByType image/jpeg A2592000 ExpiresByType text/css A2592000 ExpiresByType application/x-javascript A1 ExpiresByType text/javascript A1 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript DocumentRoot /usr/local/www/apache22/data/thesite/trunk RewriteEngine On RewriteRule !\.(htc|js|tiff|gif|css|jpg|png|swf|ico|jar|html|doc|pdf|htm|xml)$ %{DOCUMENT_ROOT}/../platform.php [L] </VirtualHost> xxxx是我的IP。 目前它转发任何不在集合(htc | js | tiff | gif | css […]

Apache拒绝确认我的站点文件夹

我在Mac上运行Apache,突然之间的http://localhost导致了Apache的HTDOCS文件夹,而一段时间以后,它正确地引用了我的Sites文件夹。 运行apachectl -D DUMP_HOSTS产生: (13)Permission denied: make_sock: could not bind to address [::]:80 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs 一些HTTPD.CONF设置: Listen 80 DocumentRoot "/Users/[username]/Sites" <VirtualHost *> DocumentRoot "/Users/[username]/Sites" ServerName localhost </VirtualHost> 帮帮我。