Skip to content
nginx_vhost.conf.master 2.38 KiB
Newer Older
server {
        listen   80;
        server_name  <tmpl_var name='alias'> <tmpl_var name='domain'>;

        access_log  /var/log/ispconfig/nginx/<tmpl_var name='domain'>/access.log;
        error_log  /var/log/ispconfig/nginx/<tmpl_var name='domain'>/error.log;

        include         /etc/nginx/proxy.conf;

        location / {
                proxy_pass      http://<tmpl_var name='ip_address'>:80;
        }

        location ~* \.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {
                # Cache static-looking files for 120 minutes, setting a 10 day expiry time in the HTTP header,
                # whether logged in or not (may be too heavy-handed).
                proxy_cache_valid 200 120m;
                expires 864000;
                proxy_pass      http://<tmpl_var name='ip_address'>:80;
        }

        <tmpl_if name='nginx_directives'>
            <tmpl_var name='nginx_directives'>
        </tmpl_if>



}


<tmpl_if name='ssl_enabled'>
###########################################################
# SSL Vhost
###########################################################
server {
        listen   443;
        server_name  <tmpl_var name='ssl_domain'> <tmpl_var name='alias'>;

        access_log  /var/log/ispconfig/nginx/<tmpl_var name='domain'>/access.log
        error_log  /var/log/ispconfig/nginx/<tmpl_var name='domain'>/error.log
        
        ### SSL cert files ###
        ssl_certificate      <tmpl_var name='config_dir'>/ssl/<tmpl_var name='ssl_domain'>.crt
        ssl_certificate_key  <tmpl_var name='config_dir'>/ssl/<tmpl_var name='ssl_domain'>.crt
        
        <tmpl_if name='has_bundle_cert'>
            ssl_client_certificate <tmpl_var name='config_dir'>/ssl/<tmpl_var name='ssl_domain'>.bundle
        </tmpl_if>
        
        ### Add SSL specific settings here ###
        keepalive_timeout    60;
        
        ###  Limiting Ciphers ########################
        # Uncomment as per your setup
        #ssl_ciphers HIGH:!ADH;
        #ssl_perfer_server_ciphers on;
        #ssl_protocols SSLv3;
        ##############################################

        include         /etc/nginx/proxy.conf;

        ### Most PHP, Python, Rails, Java App can use this header ###
        proxy_set_header X-Forwarded-Proto https;

        location / {
                proxy_pass      https://<tmpl_var name='ip_address'>:443;
        }
}
</tmpl_if>