How-To: VirtualHost

Hi to all, small manual for making your own VirtualHost :

  1. Create custom templates:

    mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
    touch /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/80VirtualHost

  2. Edit your VirtualHost :

    vi /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/80VirtualHost

    My Vhost

    <VirtualHost 0.0.0.0:443>
    ServerAdmin admi@example.com
    ServerName admin.example.com
    DocumentRoot /usr/share/roundcubemail
    <Directory /usr/share/roundcubemail>
    #Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    ErrorLog /var/log/httpd/example.com-error.log

         LogLevel warn
    
         SSLEngine on
    
         SSLCertificateFile /etc/ssl/example.com.crt
         SSLCertificateKeyFile /etc/ssl/example.com.key
         #SSLCertificateChainFile /etc/ssl/sub.class1.server.ca.pem
         #SSLOpenSSLConfCmd DHParameters /etc/ssl/dhparams.pem
         SSLStrictSNIVHostCheck Off
         SSLCACertificateFile /etc/ssl/sub.class1.server.ca.pem
         <FilesMatch "\.(cgi|shtml|phtml|php)$">
                 SSLOptions +StdEnvVars
         </FilesMatch>
    
  1. Put your custom SSL in /etc/ssl if you make HTTPS Virtualhost
a) As for OWNCLOUD you should add Trusted domain :

    config setprop owncloud TrustedDomains server.domain.com
    signal-event nethserver-owncloud-update 
  1. Run signal event :

    signal-event nethserver-httpd-update

  2. Have a good day :smile:

3 Likes