Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,94 +1,92 @@
<tmpl_loop name='vhosts'>
server {

######################################################################
## Server configuration
######################################################################

#------- Server configuration---------------------------------------------------
<tmpl_if name='ssl_enabled'>
listen <tmpl_if name='ip_address' op='!=' value='*'><tmpl_var name='ip_address'>:</tmpl_if>443 ssl spdy;
<tmpl_if name='ipv6_enabled'>
listen [<tmpl_var name='ipv6_address'>]:443 ipv6only=on ssl spdy;
</tmpl_if>
</tmpl_else>
listen [<tmpl_var name='ipv6_address'>]:443 ipv6only=on ssl spdy;
</tmpl_if>
</tmpl_else>
listen <tmpl_if name='ip_address' op='!=' value='*'><tmpl_var name='ip_address'>:</tmpl_if>80;
<tmpl_if name='ipv6_enabled'>
listen [<tmpl_var name='ipv6_address'>]:80 ipv6only=on;
</tmpl_if>
listen [<tmpl_var name='ipv6_address'>]:80 ipv6only=on;
</tmpl_if>

server_name <tmpl_var name='domain'> <tmpl_if name='alias'><tmpl_var name='alias'></tmpl_if> <tmpl_if name='ip_address' op='!=' value='*'><tmpl_var name='ip_address'></tmpl_if>;

root <tmpl_var name='web_document_root_www'>;

######################################################################
## Log configuration
######################################################################

access_log off;

</tmpl_if>
server_name <tmpl_var name='domain'> <tmpl_if name='alias'><tmpl_var name='alias'></tmpl_if> <tmpl_if name='ip_address' op='!=' value='*'><tmpl_var name='ip_address'></tmpl_if>;
root <tmpl_var name='web_document_root_www'>;

#-------- Error page ----------------------------------------------------------
error_page 404 = @fallback;
location @fallback {
proxy_pass http://<tmpl_if name='seo_redirect_enabled'><tmpl_var name='seo_redirect_target_domain'><tmpl_else><tmpl_if name='ip_address' op='!=' value="*" ><tmpl_var name='ip_address'><tmpl_else><tmpl_var name='domain'></tmpl_if></tmpl_if>:<tmpl_var name='apache2_port'>;
proxy_set_header Host <tmpl_if name='seo_redirect_enabled'><tmpl_var name='seo_redirect_target_domain'><tmpl_else><tmpl_if name='ip_address' op='!=' value="*" ><tmpl_var name='ip_address'><tmpl_else><tmpl_var name='domain'></tmpl_if></tmpl_if>;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
# ------ Log configuration ----------------------------------------------------
access_log off;
error_log off;
#error_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/nginx_error.log error;
#access_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/nginx_access.log combined;
<tmpl_if name='ssl_enabled'>
######################################################################
## SSL configuration
######################################################################

#------- SSL configuration ----------------------------------------------------
more_set_headers 'Strict-Transport-Security: max-age=15768000';
ssl_certificate <tmpl_var name='web_document_root_ssl'>/<tmpl_var name='ssl_domain'>.nginx.crt;
ssl_certificate_key <tmpl_var name='web_document_root_ssl'>/<tmpl_var name='ssl_domain'>.nginx.key;
</tmpl_if>

<tmpl_if name='ssl_enabled'>
######################################################################
## Pagespeed configuration
######################################################################

<tmpl_if name='seo_redirect_enabled'>
pagespeed LoadFromFile "https://<tmpl_var name='seo_redirect_target_domain'>" "<tmpl_var name='web_document_root_www'>/";
#------- Pagespeed configuration-----------------------------------------------
<tmpl_if name='seo_redirect_enabled'>
pagespeed LoadFromFile "https://<tmpl_var name='seo_redirect_target_domain'>" "<tmpl_var name='web_document_root_www'>/";
</tmpl_else>
pagespeed LoadFromFile "https://<tmpl_var name='domain'>" "<tmpl_var name='web_document_root_www'>/";
</tmpl_if>
pagespeed LoadFromFile "https://<tmpl_var name='domain'>" "<tmpl_var name='web_document_root_www'>/";
</tmpl_if>
</tmpl_if>

######################################################################
## Redirects configuration
######################################################################

#------- Redirects configuration-----------------------------------------------
<tmpl_if name='http_to_https'>
# Redirect http -> https
return 301 https://$server_name$request_uri;
</tmpl_if>

<tmpl_if name='seo_redirect_enabled'>
# SEO Redirect
if ($http_host = "<tmpl_var name='seo_redirect_origin_domain'>") {
return 301 $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri;
return 301 $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri;
}
</tmpl_if>

######################################################################
## Locations configuration
######################################################################

# global locations
include /etc/nginx/locations.d/*.conf;

# alias to local error docs
#------ static content --------------------------------------------------------
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv|mp3)$ {
root <tmpl_var name='web_document_root_www'>;
access_log off;
expires 30d;
}
#-------Html ------------------------------------------------------------------
location ~* ^.+\.(htm|html)$ {
root <tmpl_var name='web_document_root_www'>;
try_files $uri /index.php ;
access_log off;
expires 30d;
}
#------ Locations configuration -----------------------------------------------
# global locations
# alias to local error docs<tmpl_var name='domain'> <tmpl_if name='alias'><tmpl_var name='alias'></tmpl_if> <tmpl_if name='ip_address' op='!=' value='*'><tmpl_var name='ip_address'></tmpl_if>
<tmpl_if name='errordocs'>
location ^~ /error { root /var/www; }
</tmpl_if>

# default location
location / {
limit_req zone=ddos-cage burst=25;
proxy_cache nginx_cache;
proxy_pass http://127.0.0.1:<tmpl_var name='apache2_port'>;
}

######################################################################
## Directives configuration
######################################################################
index index.php index.html index.htm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host <tmpl_if name='seo_redirect_enabled'><tmpl_var name='seo_redirect_target_domain'><tmpl_else><tmpl_if name='ip_address' op='!=' value="*" ><tmpl_var name='ip_address'><tmpl_else><tmpl_var name='domain'></tmpl_if></tmpl_if>;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://<tmpl_if name='seo_redirect_enabled'><tmpl_var name='seo_redirect_target_domain'><tmpl_else><tmpl_if name='ip_address' op='!=' value="*" ><tmpl_var name='ip_address'><tmpl_else><tmpl_var name='domain'></tmpl_if></tmpl_if>:<tmpl_var name='apache2_port'>;
}
#------- Directives configuration ---------------------------------------------
include /etc/nginx/locations.d/*.conf;

<tmpl_var name='nginx_directives'>

}
</tmpl_loop>
Loading