Pesquisar neste blog

terça-feira, 7 de dezembro de 2010

Configurando vhost no apache2 opensuse 11.3 64 bits

Segue abaixo alguns comando úteis para configurar vhost no Apache2 no linux:

#vi /etc/apache2/listen.conf

Subistituir para NameVirtualHost *:80

Acessando a pasta de configurações do vhost

#cd /etc/apache2/vhosts.d/

Efetuando uma cópia do arquivo de exemplo:

#cp vhost.template vhost3.conf

Removendo os comentários:

#cat vhost3.conf |grep -v "#" > vhost2.conf

Removendo as linhas em branco:


egrep -v "^>|^$" vhost2.conf > vhost.conf

Exemplo de configuração do arquivo vhost.conf
<VirtualHost *:80>
    ServerAdmin webmaster@claupers.com.br
    ServerName www.claupers.com.br
    ServerAlias claupers.com.br
    DocumentRoot /srv/www/vhosts/claupers.com.br
    ErrorLog /var/log/apache2/dummy-host.example.com-error_log
    CustomLog /var/log/apache2/dummy-host.example.com-access_log combined
    HostnameLookups Off
    UseCanonicalName On
    ServerSignature On
    ScriptAlias /cgi-bin/ "/srv/www/vhosts/claupers.com.br/cgi-bin/"
    <Directory "/srv/www/vhosts/claupers.com.br/cgi-bin">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
    </Directory>
    <IfModule mod_userdir.c>
    UserDir public_html
    Include /etc/apache2/mod_userdir.conf
    </IfModule>
    <Directory "/srv/www/vhosts/claupers.com.br">
  
    Options Indexes FollowSymLinks
  
    AllowOverride None
  
    Order allow,deny
    Allow from all
  
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@hospital.com.br
    ServerName www.hospital.com.br
    ServerAlias hospital.com.br
    DocumentRoot /srv/www/vhosts/hospital.com.br
    DirectoryIndex index.php
    ErrorLog /var/log/apache2/hospital.com.br-error_log
    CustomLog /var/log/apache2/hospital.com.br-access_log combined
    HostnameLookups Off
    UseCanonicalName On
    ServerSignature On
    ScriptAlias /cgi-bin/ "/srv/www/vhosts/hospital.com.br/cgi-bin/"
    <Directory "/srv/www/vhosts/hospital.com.br/cgi-bin">
    AllowOverride All
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
    </Directory>
    <IfModule mod_userdir.c>
    UserDir public_html
    Include /etc/apache2/mod_userdir.conf
    </IfModule>
    <Directory "/srv/www/vhosts/hospital.com.br">
  
    Options Indexes FollowSymLinks
  
    AllowOverride All
  
    Order allow,deny
    Allow from all
  
    </Directory>
</VirtualHost>

Seria isso.


Cordialmente;


Claudir Pereira dos Santos

Matelândia, 13 de junho de 2011.

Nenhum comentário:

Postar um comentário