After installing Let's Encrypt the pages inside my Wordpress doesnt work

I successfully installed the SSL and my main page its working now but the inside pages not. I check my config options in wp-admin and its all ok. I also desactivate all plugins
my /etc/nginx/sites-available/ domain config file is now

server {
listen 80;
server_name www.domain.com.ar domain.com.ar;
root /var/www/wordpress;
index index.php index.html;
include snippets/letsencrypt.conf;
return 301 https://$host$request_uri;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* .(css|gif|ico|jpeg|jpg|js|png) { expires max; log_not_found off; } location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
server {
listen 443 ssl http2;
server_name www.domain.com.ar;
root /var/www/wordpress;
index index.php index.html;
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
ssl_certificate /etc/letsencrypt/live/domain.com.ar/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com.ar/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/domain.com.ar/chain.pem;
include snippets/ssl.conf;
return 301 https://domain.com.ar$request_uri;
}
server {
listen 443 ssl http2;
root /var/www/wordpress;
index index.php index.html;
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
} server_name domain.com.ar;
ssl_certificate /etc/letsencrypt/live/domain.com.ar/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com.ar/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/domain.com.ar/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
}

Ubuntu 18.04
NGINX
Let’s Encrypt Cerbot

What does this section do?:
[I see no server name there]

server {
listen 443 ssl http2;
root /var/www/wordpress;
index index.php index.html;
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
} server_name {redacted};
ssl_certificate /etc/letsencrypt/live/{redacted}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{redacted}/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/{redacted}/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
}

The other two sections don’t match:
#1:
server_name www.{redacted} {redacted};
location ~* .(css|gif|ico|jpeg|jpg|js|png) { expires max; log_not_found off; }

#2:
server_name www.{redacted};

And section #2 (which is already using TLS/HTTP) has a redirect to HTTPS?:
return 301 https://{redacted}$request_uri;

[to an name that is not covered by HTTPS]

1 Like

I change the code to this and now it works

server {
listen 80;
server_name www.domain.com.ar domain.com.ar;
include snippets/well-known;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name domain.com.ar www.domain.com.ar;
root /var/www/wordpress;
index index.php index.html index.htm;
if ($host != “domain.com.ar”) {
return 301 https://domain.com.ar$request_uri;
}
include snippets/well-known;
ssl_certificate /etc/letsencrypt/live/domain.com.ar/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com.ar/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/domain.com.ar/chain.pem;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ‘ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS’;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 30s;
access_log /var/log/nginx/domain.com.ar.access.log;
error_log /var/log/nginx/domain.com.ar.error.log;
client_max_body_size 100M;
autoindex off;
location / {
try_files $uri $uri/ /index.php?args; } location ~ .php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Thanks

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.