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

472
Views
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 answers
Answer question

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 Report

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 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!