Anderson Jacson </a>  
Login

Menu

4 visitantes online (1 na seção: Artigos e Dicas)

Usuários: 0
Visitantes: 4

mais...

SmartSection is developed by The SmartFactory (http://www.smartfactory.ca), a division of INBOX Solutions (http://inboxinternational.com)
Linux > Virtual Host apache no Debian com mod_proxy
Virtual Host apache no Debian com mod_proxy
Publicado por Anderson em 05/12/2009 (1968 leituras)

 

 Virtual Host apache no Debian com mod_proxy

 

Começe criando o arquivo  /etc/apache2/conf.d/virtual.conf com o seguinte conteúdo:

 NameVirtualHost *

 

Algumas confs de virtual host com mod_proxy: 

 

Arquivo: site_default

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</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 /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>


ProxyRequests off
<Proxy *>
Order deny,allow
# Allow from all
  Allow from 192.168.1.0/24
</Proxy>

#Redir 1

  ProxyPass /aplicacao http://ip_do_outro_servidor:8080/aplicacao
  ProxyPassReverse 
/aplicacao http://ip_do_outro_servidor:8080/aplicacao


#Redir 2
ProxyPass
/aplicacao2 http://ip_do_outro_servidor2:8080/aplicacao2
ProxyPassReverse
/aplicacao2 http://ip_do_outro_servidor2:8080/aplicacao2

# SetOutputFilter proxy-html
# ProxyHTMLURLMap http://localhost:8001 /
</VirtualHost>

 

Arquivo redir_para_plone:

NameVirtualHost intranet:80
<VirtualHost *>
ServerName intranet
ServerAlias intranet
  ServerAdmin suporte@anderson
CustomLog /var/log/apache2/access_intraner.log combined
ErrorLog /var/log/apache2/error_intranet.log
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^:]+)(:|$)
RewriteRule ^(.*)$ http://localhost:8087/VirtualHostBase/http/intranet:80/intranet/VirtualHostRoot/$1 [P,L]
# RewriteRule ^(.*)$ http://localhost:8180/VirtualHostBase/http/%1:80/portal/VirtualHostRoot$1 [P,L]
</VirtualHost>
 

 

 Arquivo para outra url com conteúdo em outro servidor com o mod_proxy:

 

NameVirtualHost sitex.andersonjacson.com.br

<VirtualHost *>

<Proxy *>
Order deny,allow
# Allow from all
  Allow from 192.168.1.0/24
</Proxy>

ServerName sitex.andersonjacson.com.br

ProxyPass / http://outrosite.com.br/alguma_coisa_se_quiser

ProxyPassReverse / http://outrosite.com.br/alguma_coisa_se_quiser

</VirtualHost>
 

 

Outro Exemplo: 

 

 NameVirtualHost sistemas.andersonjacson.com.br
<VirtualHost *>

DocumentRoot /app/sistemas/
<Directory /app/sistemas/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>



<Proxy *>
Order deny,allow
# Allow from all
Allow from 172.25.4.0/23
</Proxy>

ServerName sistemas.andersonjacson.com.br
CustomLog /var/log/apache2/sistemas/access_sistemas.log combined
ErrorLog /var/log/apache2/sistemas/error_sistemas.log


##Agenda
ProxyPass /agenda/ http://localhost:6000/agenda/
ProxyPassReverse /agenda/ http://localhost:6000/agenda/


##Calendario
ProxyPass /calendario/ http://localhost:6002/calendario/
ProxyPassReverse /calendario/ http://localhost:6002/calendario/

 

Have Fun 

/ Etc/apache2/conf.d/virtual.conf
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBulgarianCatalanChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDetect languageDutchEnglishEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishThaiTurkishUkrainianUrduVietnameseWelshYiddishAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBulgarianCatalanChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishThaiTurkishUkrainianUrduVietnameseWelshYiddish
English (auto-detected) » Portuguese
/ Etc/apache2/conf.d/virtual.conf



AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBulgarianCatalanChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDetect languageDutchEnglishEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishThaiTurkishUkrainianUrduVietnameseWelshYiddishAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBulgarianCatalanChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishThaiTurkishUkrainianUrduVietnameseWelshYiddish
Detect language » undefined

Navegue pelos artigos
Artigo prévio Mudando formato do arquivo (Dos/Unix) no Vim Próximo artigo
Os comentários são de propriedade de seus respectivos autores. Não somos responsáveis pelo seu conteúdo.
Pesquisa