Artigos‎ > ‎Email‎ > ‎

Novos diretórios para Dovecot e Apache


Primeiramente gostaria de salientar que não sou o autor principal do conteúdo deste artigo. A minha intenção é de mostrar o que outros autores tem realizado (referenciando links para o conteúdo original) neste blog até como um guia pessoal para uso próprio e ainda compartilhar minhas anotações e pequenas modificações que realizo no conteúdo, desejando que possa ajudar mais alguém em algum lugar.
First and foremost, I take no credit for any of this post’s content. I am really just taking what others have done (which I have links to bellow) and am putting it on my blog for a personal reference and hopefully the small changes that I made to their guides will help someone somewhere.


Para alterar o local de armazenamento do Dovecot no ubuntu fiz as seguintes alterações:

sudo gedit /etc/dovecot/dovecot.conf

## Dovecot configuration file

protocols = imap imaps pop3 pop3s
#mail_location = maildir:/srv/vmail/%d/%n/Maildir
mail_location = maildir:/srv/storage/vmail/%d/%n/Maildir
auth default {
mechanisms = plain login
passdb sql {
args = /etc/dovecot/dovecot-sql.conf
}
userdb static {
#args = uid=500 gid=500 home=/srv/vmail/%d/%n allow_all_users=yes
args = uid=500 gid=500 home=/srv/storage/vmail/%d/%n allow_all_users=yes
}
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0600
user = vmail
}
client {
path = /var/spool/postfix/private/auth
mode = 0600
user = postfix
group = postfix
}
}
}
protocol lda {
#log_path = /srv/vmail/dovecot-deliver.log
#global_script_path = /srv/vmail/globalsieverc
log_path = /srv/storage/vmail/dovecot-deliver.log
global_script_path = /srv/storage/vmail/globalsieverc

postmaster_address = postmaster@casa.lan
auth_socket_path = /var/run/dovecot/auth-master
mail_plugins = cmusieve
}
ssl_cert_file = /etc/ssl/certs/mail.casa.lan.pem
ssl_key_file = /etc/ssl/private/mail.casa.lan.key

#ssl_disable = no
ssl = yes

disable_plaintext_auth = no

Garanta que o usuário vmail (500) tem acesso ao diretório e arquivos:
chown -R vmail:vmail /srv/storage/vmail

Reinicialize os serviços:
sudo /etc/init.d/dovecot restart



Para alterar o local de armazenamento do Apache no ubuntu fiz as seguintes alterações:

sudo gedit /etc/apache2/sites-available/default

<VirtualHost *:80>

  ServerAdmin root@casa.lan
  ServerName master.casa.lan
  ServerAlias localhost master.casa.lan
  #DocumentRoot /srv/www/html/
  DocumentRoot /srv/storage/www/html/

  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  #<Directory /srv/www/html/>
  <Directory /srv/storage/www/html/>
    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>
  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>
</VirtualHost>

Não se esqueça de fazer o mesmo tipo de alteração em:
sudo gedit /etc/apache2/sites-available/default-ssl
sudo gedit /etc/apache2/sites-available/arvati
sudo gedit /etc/apache2/sites-available/drupal

Exemplo:
<VirtualHost *:80>

  ServerAdmin root@casa.lan
  ServerName www.casa.lan
  ServerAlias www.casa.lan
  DirectoryIndex index.php
  #DocumentRoot /srv/www/drupal/
  DocumentRoot /srv/storage/www/drupal/

  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  #<Directory /srv/www/drupal/>
  <Directory /srv/storage/www/drupal/>
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
  #ScriptAlias /cgi-bin/ /srv/storage/www/drupal/cgi-bin/
  ScriptAlias /cgi-bin/ /srv/www/drupal/cgi-bin/
  #<Directory "/srv/www/drupal/cgi-bin">
  <Directory "/srv/storage/www/drupal/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>
  ErrorLog /var/log/apache2/drupal.error.log
  CustomLog /var/log/apache2/drupal.access.log combined
  LogLevel warn
  ServerSignature On
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
  ServerAdmin root@casa.lan
  ServerName www.casa.lan
  ServerAlias www.casa.lan
  DirectoryIndex index.php
  #DocumentRoot /srv/www/drupal/
  DocumentRoot /srv/storage/www/drupal/
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>
  #<Directory /srv/www/drupal/>
  <Directory /srv/storage/www/drupal/>
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
  #ScriptAlias /cgi-bin/ /srv/www/drupal/cgi-bin/
  ScriptAlias /cgi-bin/ /srv/storage/www/drupal/cgi-bin/
  #<Directory "/srv/www/drupal/cgi-bin">
  <Directory "/srv/storage/www/drupal/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>
  ErrorLog /var/log/apache2/drupal.error.log
  CustomLog /var/log/apache2/drupal.access.log combined
  LogLevel warn
  ServerSignature On

# SSL Specific options
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/ssl/certs/www.casa.lan.crt
    SSLCertificateKeyFile /etc/ssl/private/www.casa.lan.key
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

</VirtualHost>
</IfModule>



Garanta que o usuário www-data tem acesso ao diretório e arquivos:
chown -R www-data:www-data /srv/storage/www

Reinicialize os serviços:
sudo /etc/init.d/apache2 restart






Comments