1

Assumption:

Application is running on https://example.com [which is static serving from /home/centos/projects/dist.example.com]

I am trying to run https://example.com/blogs to serve wordpress blog application.

Below is my nginx config

    server {
    server_name example.com;

    root /home/centos/projects/dist.example.com;
    index  index.html;

    access_log /home/centos/log/example/access.log;
    error_log /home/centos/log/example/error.log;

    location / {
       try_files $uri /index.html;
       expires -1;
       add_header  Cache-Control public;
    }

    location /download {
      proxy_pass http://127.0.0.1:7000/api/downloads/;
    }

    location /blogs {
        try_files $uri $uri/ /blogs/index.php?q=$uri&$args;
        location ~ \.php$ {
        try_files $uri /index.php = 404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
         }
    }

    location ~ /\.ht {
        deny all;
    }

    ##
    # `gzip` Settings
        #
    #
    gzip on;
        gzip_disable "msie6";

        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level    6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_min_length    256;
        gzip_types
            application/atom+xml
            application/javascript
            application/json
            application/rss+xml
            application/vnd.ms-fontobject
            application/x-font-ttf
            application/x-web-app-manifest+json
            application/xhtml+xml
            application/xml
            font/opentype
            image/svg+xml
            image/x-icon
            text/css
            text/plain
            text/javascript
            text/x-component;
}

I am running my nginx as root and centos linux set on permissive mode. I am successfully able to run the example.com but when i try to run example.com/blogs it gives nginx error 403 forbideed

below is the part of my php-fpm conf

user = centos
; RPM: Keep a group allowed to write in log dir.
group = centos

;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock

listen.owner = root
listen.group = root
;listen.mode = 0660

I am not getting where i am facing issue with permission

2
  • what are the permissions and ownership of /home/centos/projects/dist.example.com/blog ?? Commented Mar 8, 2018 at 10:44
  • centos is the ownership of /home/centos/projects/dist.example.com/blog Commented Mar 8, 2018 at 10:50

1 Answer 1

1

I got an answer to this problem

  location  /blog { 
     resolver 8.8.8.8; 
     proxy_pass https://betablog.example.com;
     if ($request_method !~ ^(GET|HEAD|POST)$ ){
        return 444;
    }
  }

Also make a config change in wp-config.php change the site name to http://example.com/blogs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.