Installing Wordpress on virtualhost

Not really, https is working just fine, it is just that inner code of WP call (js)scripts via http and not via httpS. I have found some sample scripts for Nginx on htaccess, but none of them are working :frowning:

I guess I have been spoiled all those years by e-smith easy of use and module makers all that time :slight_smile:

Thanks!

I came across this, but I have no clue how to test this.


When using a reverse proxy with Nginx and WordPress, it is common to encounter mixed content issues. This occurs when the WordPress site is served over HTTPS, but some of the resources being loaded (such as images, scripts or stylesheets) are still being requested over HTTP.

To fix this issue, you can add the following lines to your Nginx configuration file:

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

These lines will tell WordPress that it is being served over HTTPS, and will ensure that all resources are loaded using HTTPS as well.


And this is what I don’t want:

Additionally, you can use a plugin like Really Simple SSL to automatically detect and fix mixed content issues on your WordPress site. This plugin will also handle other common SSL-related issues, such as redirecting HTTP traffic to HTTPS.

These lines in wp-config.php worked for me to have no mixed content anymore. I found it here.

The example wordpress domain is wordpress.domain.tld

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

define('.COOKIE_DOMAIN.', 'wordpress.domain.tld');
define('.SITECOOKIEPATH.', '.');

if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
        $_SERVER['REMOTE_ADDR'] = $list[0];
  }
define('WP_HOME', 'https://wordpress.domain.tld');
define('WP_SITEURL', 'https://wordpress.domain.tld');
$_SERVER['HTTP_HOST'] = 'wordpress.domain.tld';
$_SERVER['REMOTE_ADDR'] = 'https://wordpress.domain.tld';
$_SERVER['SERVER_ADDR'] = 'wordpress.domain.tld';

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
       $_SERVER['HTTPS']='on';

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

I requested a letsencrypt cert for the virtualhost but I think it’s not needed.

BTW, if I disable the letsencrypt cert for the virtualhost, it’s still there, even after reboot. How to revert to the self-signed cert? @stephdl

4 Likes

2 posts were split to a new topic: Disabling NS8 Nginx Virtualhost Lets Encrypt certificates is not possible

and works for me too! Bravo again
 Thanks! I had 1 other issue but that had to do with a chrome plugin.

Thanks again.

2 Likes

add to your custom website a upgrade-insecure-requests to redirect transparently all content http to https. It seems specific to wordpress Content Security Policy | WordPress.org

since we are using Nginx as the engine, this is where we need to look forward when we want a fix.

cc @davidep

  • note1 : do you think we could bundle upgrade-insecure-requests as default inside webserver ?
  • note2 : we shared about to remove Nginx in the title of the module, but it is a clue where to search when we need to fix something

CSP: upgrade-insecure-requests - HTTP | MDN

9001 is your virtualhost ID, you can find it at

image

vim /home/webserver2/.config/state/conf.d/dyn-9001.custom

## avoid mixed content https/http for wordpress. good new internet explorer cannot works with it : https://caniuse.com/upgradeinsecurerequests
add_header Content-Security-Policy upgrade-insecure-requests;

then go to the virtualhost menu and save again to restart nginx and build again the configuration

writing a how to on how to install wordpress

5 Likes

:ok_hand: :pray:

2 Likes

Would it be an impertinent request to ask whether it would not be better to provide a container via the software center, consisting of a vhost with a selectable PHP version, database and WordPress?
I think that would also help to reduce the support volume here.

well this won’t be available one day I bet, but in fact what we could provide is a full container with mariadb bundled and the good expected version of PHP for wordpress, maybe this was what you were requested

bundle database and webserver I am not sure it is a good idea, except it will lower the use case of user@localhost that it won’t never work with two containers to user@% which means anyhost

cc @davidep

3 Likes

trying to write a full howto @capote and I would be pleased to know if it could explain for non technical all steps and tricks

3 Likes

I will test it. Thank you.

1 Like

@stephdl:

“trying to write a full howto @capote and I would be pleased to know if it could explain for non technical all steps and tricks”

Any updates, on this project ?

I would like to link several Mycloud Western Digital EX2 Ultra NAS boxes to my cloud-based worpress.com domain, thru my nethserver

hello

please open your thread and explain your issue, I am not sure to understand

now it is available also ns8-lamp (integrated linux apache mysql php in one container)

@stephdl

I have several Western Digital Mycloud NAS EX2 Ultra storage boxes, networked, in my home.

I also have 2 nethservers, on 2 separate HP Elitedesk 800 g2 mini PCs, also in my home network.

My EX2 Ultra NAS storage boxes have local wordpress.com addons, thru each EX2 NAS firmware.

I have remotely linked all EX2 NAS boxes thru the built-in wordpress.com NAS add-on widgets, to the cloud-based wordpress.com servers.

I would like to connect both nethservers, to each EX2 NAS box, thru a remote link, via the cloud-based wordpress.com servers, so both nethservers, can be a Samba PDC & BDC, linked to my cloud-based wordpress website.

I realize i can directly link both nethserver, to all EX2 NAS boxes, thru my home network, BUT i would like to allow my family, to remotely access both nethserver and EX2 NAS boxes, via their own wordpress.com account, via my cloud-based wordpress.com website.

Basically, I would like my family to remotely log into my cloud-based wordpress.com website, from their home network (or cell phone), to upload, and store thier respective photos and videos, on the EX2 NAS boxes, and organize, locate and share the photos and videos, with the Samba directories, located on the nethservers.

Hope this helps!!!