• Deployed WordPress with the following

    – Created the website static HTML, runs on example.com
    – Created the blog with WordPress, runs on example.com/blog

    Used NGINX, MariaDB, WordPress running with docker. HTML Website is isolated from this except for Nginx used as a reverse proxy for example.com

    Issues :

    – When we click on posts we see “Invalid post type.” – URL is https://example.com/blog/wp-admin/edit.php

    – Activate Plugin, error “Sorry, you are not allowed to access this page.”

    Here is my NGINX Conf

    user root;
    
    worker_processes auto;
    
    events {
        worker_connections  10240;
        accept_mutex off;
    }
    
    thread_pool recruiter_tp threads=32 max_queue=65536;
    
    http {
      include            mime.types;
      default_type       application/octet-stream;
      access_log on;
      sendfile           on;
      sendfile_max_chunk 512k;
      tcp_nopush         on;
      keepalive_timeout  65;
      gzip               on;
      gzip_types         text/plain text/css text/javascript
                          application/javascript application/json
                          application/xml;
      index              index.html index.htm;
      server_tokens off;
      etag off;
      proxy_cache_path  /home/chache  levels=1:2 keys_zone=WS_STATIC:10m max_size=5g inactive=60m use_temp_path=off;
      log_format rt_cache '[$time_local] [Cache:$upstream_cache_status] [$host] [Remote_Addr: $remote_addr] - $remote_user - $server_name to: $upstream_addr: "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" ' ;
    
      upstream website {
        server 192.0.1.20:4000 max_fails=1 fail_timeout=50s;
        server 192.0.1.21:4000 max_fails=1 fail_timeout=50s;
        server 192.0.1.22:4000 max_fails=1 fail_timeout=50s;
        server 192.0.1.25:4000 max_fails=1 fail_timeout=50s;
      }
    
      server {
          listen 80;
          listen [::]:80;
          server_name example.com;
          return 301 $scheme://example.com$request_uri;
      }
    
      server {
        listen 443 ssl;
        listen [::]:443 ssl;      
        server_name example.com;
        add_header X-Frame-Options "SAMEORIGIN";
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
    
        root /usr/share/nginx/html;
    
        ssl_certificate    /etc/nginx/ssl/example.com.chained.crt;
        ssl_certificate_key    /etc/nginx/ssl/example.com.key;
    
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
        
        chunked_transfer_encoding on;
    
        location = /pages/ {
          deny all;
          return https://example.com/404;
        }
    
        location = /assets/vendor/animate.css/source/ {
          deny all;
          return https://example.com/404;
        }
    
        location /blog {
          access_log /var/log/nginx/blog.access.log;
          error_log /var/log/nginx/blog.error.log notice;
          alias /var/www/html;
          index index.php;
          try_files $uri $uri/ /html/index.php;
        }
    
        location ~* ^/blog/(.*\.php)$ {
          access_log /var/log/nginx/blog.php.access.log;
          error_log /var/log/nginx/blog.php.error.log notice;
          alias /var/www/html/$1;
          try_files "" /html/index.php;
          include /etc/nginx/fastcgi_params;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_NAME $1;
          fastcgi_param SCRIPT_FILENAME /var/www/html/$1;
          fastcgi_pass  wordpress:9000;
        }
        location / {
          rewrite /(.*) /$1  break;
          proxy_set_header        Host $host:$server_port;
          proxy_set_header        X-Real-IP $remote_addr;
          proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header        X-Forwarded-Proto $scheme;
          proxy_pass              https://website;
          proxy_http_version 1.1;
          proxy_request_buffering off;
          proxy_buffering off;
        }
    
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
          root /usr/share/nginx/html;
          internal;
        }
        client_max_body_size 4G;
        keepalive_timeout 10;
    
        access_log  /dev/null;
        error_log  /var/log/nginx/error.log error;
      }
    }
    • This topic was modified 2 years, 8 months ago by jinnabalu.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi there,
    Have you managed to solve the issue?

    The problem seems to be with the NGINX configuration. From what I could find, a few people had the exact same issues as you and they fixed it by editing their config. (See here)

    If you haven’t already, I’d recommend looking over this recipe to check if you’re missing anything that might be important.

    Hope this helps
    -Jamie

Viewing 1 replies (of 1 total)
  • The topic ‘website.com with html website and website.com/blog with wordpress, website’ is closed to new replies.