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

475
Visualizações
nginx: php-fpm is kicking in for main website, but not second site

I have two web folders:

 /var/www/mainapplication.com/public
 /var/www/helpsystem

they are both PHP sites. From the main application, you can click on a "help" button that links to https://mainapplication.com/help.php

Problem:

Right now, when someone clicks on the help button, the tries to download the file help.php.

Code:

/var/www/mainapplication.com/help.php looks like this in part:

 $url = https://mainapplication.com/help/index.php
 $header("Location:$url");

The nginx conf file looks like this:

server {
        listen 443 ssl;
        root /var/www/mainapplication.com/public;
        server_name mainapplication.com;

        ssl_certificate /etc/ssl/a/bundle.crt;
        ssl_certificate_key     /etc/ssl/a/a.key;
        ssl_protocols   TLSv1.2;

        error_log /var/log/nginx/mainapplication_com.log warn;
        index login.php;

        location / {
                allow all;
                try_files $uri $uri/ /=404;
        }

        location ^~ /help {
                alias /var/www/helpsystem;
                try_files $uri $uri/ /=404;
        }

        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;                  
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
}

It seems the php section is not working for the help system, although it is for the main site. Any tips would be appreciated. right now I'm trying to switch between the alias command and another root command.

EDIT 1

when I change the nginx conf to look like this:

   location ^~ /help {
           alias /var/www/helpsystem;
           try_files $uri $uri/ /=404;
   }

   location ~ \.php$ {
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }

I get the following error:

2020/03/24 19:37:06 [error] 9241#9241: *1 rewrite or internal redirection cycle while internally redirecting to "/=404", client: 198.1.2.1, server: mainapplication.com, request: "GET /help.php HTTP/1.1", host: "mainapplication.com", referrer: "https://mainapplication.com/widget_settings.php"

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Expand the wiki section:

location ^~ /wiki {
        alias /var/www/helpsystem;
        try_files $uri $uri/ /=404;

   location ~ \.php$ {
           fastcgi_pass 127.0.0.1:9000;                  
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }
}
over 4 years ago · Santiago Trujillo Relatório

0

   location ^~ /help {
           alias /var/www/helpsystem;
           try_files $uri $uri/ /=404;
      location ~ \.php$ {
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
   }
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