Howto setting wordpress working under proxy nginx

This is my note howto setting WordPress

First add this at wp-config.php

define('FORCE_SSL_ADMIN', true);

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false){
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
    $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}

define('WP_HOME', 'https://domain name');
define('WP_SITEURL', 'https://domain name');



// add this at nginx site config


server {
    listen 443 ssl;
    server_name domain name;

    ssl_certificate /etc/letsencrypt/live/domain name/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain name/privkey.pem;

    access_log /var/log/domain name/logs/access.log;
    error_log /var/log/domain name/logs/error.log;


location / {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
            proxy_set_header X-Forwarded-Proto https;
            proxy_pass http://10.80.1.2:6000;

    }

}

Discover more from Susiloharjo

Subscribe to get the latest posts sent to your email.

Related Posts

nginx-error-log

Howto resolve nginx proxy manager failed to renew ssl

  I’ve been using Nginx Proxy Manager for a couple of years now. It provides free SSL with Let’s Encrypt, is designed with security in mind, and…

embracing-ai-in-the-workplace

Embracing AI in the Workplace: A Guide for Professionals

Hello, professionals of all ages and experience levels! Are you ready to dive into the exciting world of AI at work? Whether you’re a seasoned veteran or…

people coding using ai

How to Use Google Trends to Your Advantage

Hey there, trendsetters and curious minds! Have you ever wondered what the world is buzzing about online? Well, Google Trends is your backstage pass to the hottest…

data-access-management

Understanding and Implementing Data Access Management

Managing who has access to your company’s data is crucial for keeping it safe from unauthorized use. Data access management is all about using methods like password…

ai-generated-smart-kpis

Transform Your Business with AI-Generated Smart KPIs

Imagine if your company’s key performance indicators (KPIs) could do more than just track performance—they could predict trends, align your team’s efforts, and even improve your inventory…

Data Analytics

Making Data Analytics Work: Best Practices for Success

In today’s world, companies are all-in on analytics, convinced that data is their golden ticket to success. But despite the enthusiasm and hefty investments, most analytics projects…

Discover more from Susiloharjo

Subscribe now to keep reading and get access to the full archive.

Continue reading