objetivo

abordar alguns exemplos de configuração do apache2

exemplos

dominio principal

<VirtualHost 200.103.82.51:80>
   ServerAdmin admin@empresa.com.br
   ServerName www.empresa.com.br
   DocumentRoot  /home/gutera/public_html
   ErrorLog /var/log/apache/empresa-www-error.log
   CustomLog /var/log/apache/empresa-www-access.log common
</VirtualHost>

<Directory "/home/empresa/public_html">
    Options None
    AllowOverride AuthConfig Limit
    Order allow,deny
    Allow from all
</Directory>

subdominio

<VirtualHost 200.103.82.51:80>
   ServerAdmin admin@empresa.com.br
   ServerName guto.empresa.com.br
   DocumentRoot  /home/guto/public_html
   ErrorLog /var/log/apache/empresa-guto-error.log
   CustomLog /var/log/apache/empresa-guto-access.log common
</VirtualHost>

<Directory "/home/guto/public_html">
    Options Indexes
    AllowOverride AuthConfig Limit
    Order allow,deny
    Allow from all
</Directory> 

redirecionamento

<VirtualHost 200.103.82.52:80>
   ServerAdmin admin@empresa.com.br
   ServerName sistema.empresa.com.br
   Redirect / http://www.empresa.com.br/sistema/
</VirtualHost>

alias, exemplo1

Alias /mp3/ /storage/mp3/

<Directory /storage/mp3/>
   Options None
   order deny,allow
   deny from all
   allow from 127.0.0.1
   allow from 200.103.92.51
</Directory>

alias, exemplo2

Alias /sistema/ /home/empresa/sistema/

<Directory /home/empresa/sistema/>
   Options AuthConfig
   Order deny,allow
   deny from all
   Allow from 10.0.103.2
   AuthType Basic
   AuthUserFile /home/empresa/auth/passwd
   AuthName "autenticacao para acesso ao sistema da empresa"
   require valid-use
</Directory>

script alias

ScriptAlias /cgi-bin/ /home/empresa/cgi-bin/

<Directory /home/empresa/cgi-bin/>
   Options ExecCGI
   order deny,allow
   deny from all
   allow from 127.0.0.1
</Directory>

referências



apache2_virtualdomain_exemplos.txt · Last modified: 2011/01/02 19:49 by gutocarvalho
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0