Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda