WordPress installation under HTTPS

Moderator
t-p

(@t-p)

I understand that it is a “mixed content” issue

– Disable all caching and optimization plugins,
– Install the plugin Better Search And Replace. Search for http://example.com and replace with https://example.com ; Review this tutorial: https://www.wpbeginner.com/plugins/how-to-fix-the-mixed-content-error-in-wordpress-step-by-step/
– Re-enable your caching and optimiztion plugins and clear the cache.
– Disable/delete “Better Search Replace”.

Thread Starter
qneo

(@qneo)

Thanks for your reply.

Are all these steps necessary?

Is it not possible to set up https in advance for a new site? For example, declare a variable in a config file so that wordpress knows what it’s about right from the start.

I find it strange that you have such a view at all. I almost always install my WordPress projects with SSL, I’ve never seen anything like this.

My tip would be that something is wrong with your server configuration. The styles are probably not being loaded. Have a look at the server to see if you can find any errors there. In the error log, for example

Otherwise, you could also create the wp-config.php manually. To do this, copy wp-config-sample..php and adjust the information in it. There you can also configure the domain to be used with these two entries:

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );

Source: https://developer.projectdmc.org/advanced-administration/upgrade/migrating/

Thread Starter
qneo

(@qneo)

The styles are probably not being loaded. Have a look at the server to see if you can find any errors there. In the error log, for example

Yes, the dev console shows that requests are sent for css & js files, but via http. So something is not right from the start, maybe something is missing in the config file?

<?php

define( 'DB_NAME', 'wp' );

/** Database username */
define( 'DB_USER', 'wp' );

/** Database password */
define( 'DB_PASSWORD', 'wpwp123' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );

$table_prefix = 'wp_';

define( 'WP_DEBUG', false );

/* Add any custom values between this line and the "stop editing" line. */

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Add the 2 lines I mentioned above directly after

/* Add any custom values between this line and the “stop editing” line. */

add. And adapt the domain in these lines to your URL – including https.

Thread Starter
qneo

(@qneo)

Okay, I know what’s wrong now.

I use nginx proxy to redirect traffic to my docker container where I have apache & wordpress. When I visit the site without using a proxy, the page looks as it should.

I guess I’m doing something wrong in my proxy_pass, but I don’t know what? After all, the page shows that https is enabled.

NGINX:

server {
listen 443 ssl;
server_name site-1.mydomain.com;

ssl_certificate /ssl/mydomain.com/fullchain1.pem;
ssl_certificate_key /ssl/mydomain.com/privkey1.pem;

location / {
proxy_pass http://6664bcef9f967204f6096cad_webserver:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}

APACHE:

<VirtualHost *:80>
ServerName site-1.mydomain.com
DocumentRoot /user/site/
</VirtualHost>

<VirtualHost *:443>
ServerName site-1.mydomain.com
DocumentRoot /user/site/
</VirtualHost>

The server-side configuration is not actually the subject of this forum. I would recommend that you contact a community that has more insight into this. However, I quickly found a post that describes exactly what is happening to you – and you may find a solution there: https://stackoverflow.com/questions/57877915/cant-get-nginx-reverse-proxy-to-load-css-images-of-web-application

Thread Starter
qneo

(@qneo)

Thanks guys, it’s solved now

Great if it is working now. You are welcome to set the topic to solved.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer