config
# Redirect everything to the main site. We use a separate server statement and NOT an if statement - see http://wiki.nginx.org/IfIsEvil
server {
server_name _;
return 302 $scheme://casamentocivil.com.br$request_uri;
}
server {
listen 80;
server_name casamentocivil.com.br www.casamentocivil.com.br;
rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https
}
server {
# disable access log and define error_log to critical.
# access_log off;
error_log /var/log/nginx/casamentocivil.com.br.error.log crit;
# increase upload size limit
client_max_body_size 4M;
# listen at 80 port, on any ip address.
listen 443;
server_name casamentocivil.com.br www.casamentocivil.com.br;
ssl on;
ssl_certificate /etc/ssl/casamentocivil_com_br/www_casamentocivil_com_br_ssl-bundle.crt;
ssl_certificate_key /etc/ssl/casamentocivil_com_br/www_casamentocivil_com_br.key;
proxy_set_header X-Forwarded-For $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
server_tokens off;
root /var/www/casamentocivil.com.br/public_html;
index index.php index.html index.htm;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
# define the root directory of your site and index files.
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ [^/]\.php(/|$) {
root /var/www/casamentocivil.com.br/public_html;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param HTTP_PROXY "";
include fastcgi_params;
}
# WP wordfence - hide .user.ini
location ~ ^/loja/\.user\.ini {
deny all;
}
location ~ ^/blog/\.user\.ini {
deny all;
}
# Wordpress in subdirectory
location /blog/ {
index index.php;
try_files $uri $uri/ /blog/index.php?$args;
}
include global/restrictions.conf;
include global/wordpress.conf;
}