• Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Precios
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

168
Vistas
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"

11 months ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

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;
   }
}
11 months ago · Santiago Trujillo Denunciar

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;
      }
   }
11 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.