Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
Running Wordpress/NGINX from different path

Im learning NGINX, so any help is really appreciated.

I have the frontend of a website running as the root of mysite.com, and now I want to run wordpress from mysite.com/blog.

My file structure is: /srv/mysite/frontend /srv/mysite/wordpress

this is the error i've been getting from the nginx logs

2020/03/29 00:09:03 [error] 23049#23049: *39 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: XXXXXXX, server: www.mysite.com, request: "GET /api HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "mysite.com"

and this is my nginx config file so far

    listen 80 default_server;
    server_name www.mysite.com mysite.com;
    charset utf-8;

    location ^~ /blog {
        root /srv/mysite/wordpress;
    }

   location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    }

    location / {
        root /srv/mysite/frontend/dist;
        try_files $uri /index.html;
    }

}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This error message shows either the wrong path of the sock file or the permissions. Make sure the php sock file exists in the path /run/php/php7.2-fpm.sock and change the permissions of the file.

For Debian

chown -R  wwww-data:www-data /run/php/php7.2-fpm.sock

For Rhel

chown -R nginx:nginx /run/php/php7.2-fpm.sock

Also, you can try this config.

   location /blog {
        root /srv/mysite/wordpress;
    }

  location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!