Eu uso um servidor Nginx muito semelhante e o seguinte funciona muito bem para mim, no entanto, eu prefiro pegar uma rota diferente e dividir a configuração de blocos de servidor para "Não seguro - http" e "Seguro - https" individualmente. Além disso, de acordo com a estrutura do seu subdiretório, convém dar uma olhada neste rtcamp artigo para ajustar sua diretiva location / {}
da seguinte forma:
# HTTPS Secure Server
#
server {
listen 443 default_server ssl;
ssl on;
ssl_certificate /path/to/ssl/certificate.crt;
ssl_certificate_key /path/to/ssl/certificate.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Nginx 1.6 PCI compliance ssl directives, the first one is stronger but slower
#It should be preferred when saving credit card and/or sensible information is needed.
#e.g. If redirecting to payment gateways providers such as PayPal is all you need, them it can be safely disabled here.
# ssl_ciphers HIGH:!aNULL:!MD5;
ssl_ciphers HIGH:!aNULL:!MD5:!kEDH;
ssl_prefer_server_ciphers on;
root /srv/www/guillaumemolter/htdocs;
index index.php;
server_name guillaumemolter.dv *.guillaumemolter.dv;
location / {
try_files $uri $uri/ /wp-app/index.php?q=$uri&$args;
}
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Alternatively Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#location ~ \.php$ {
#try_files $uri =404;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_index index.php;
# #include fastcgi_params;
#}
location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js) {
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires 7d;
access_log off;
}
}
..
server {
listen 80 default_server;
server_name guillaumemolter.dv *.guillaumemolter.dv
root /srv/www/guillaumemolter/htdocs;
index index.php;
# Simple redirect - Force non SSL site to redirect traffic to SSL
return 301 https://guillaumemolter.dv$request_uri;
return 301 https://guillaumemolter.dv$request_uri;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/wp-app(/[^/]+)?(/wp-.*) /wp-app$2 last;
rewrite ^/wp-app(/[^/]+)?(/.*\.php)$ /wp-app$2 last;
}
location / {
try_files $uri $uri/ /wp-app/index.php?$args ;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Alternatively Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#location ~ \.php$ {
#try_files $uri =404;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_index index.php;
# #include fastcgi_params;
#}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
}
..
E no seu arquivo index.php, altere o caminho para /wp-app/wp-blog-header.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-app/wp-blog-header.php' );
..
Além disso, se um certificado SSl estiver configurado, verifique se o URL do site do WordPress e o URL da Página Inicial estão corretos. Ele pode ser alterado em Configurações Gerais do WordPress ou colocando-se essas duas linhas no wp-config.php, onde "example.com" é o local correto do seu site. Nota Esta não é necessariamente a melhor correção, é apenas codificar os valores no próprio site. Você não poderá mais editá-las na página Configurações gerais ao usar este método.
define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');