So I am running a site www.example.com. Initially, I was using apache and any hit to my site would be redirected to www.example.com/path. Now this redirection is defined in my httpd.conf like:
Redirect 301 /index.html http://www.example.com/path
and my VirtualHost setting for this domain looks like this:
<VirtualHost 1.1.1.1:80>
DirectoryIndex index.php index.html index.htm index.shtml
ServerAdmin root@www.example.com
DocumentRoot "/var/www/html"
ServerName www.example.com
ScriptAlias /path "/path/to/cgi/script"
</VirtualHost>
So basically when someone visits www.example.com, he is redirected to www.example.com/path which is executes a CGI script as defined by the ScriptAlias directive.
Everything was working fine until I had to do the following:
Install nginx and configured it to act as a reverse proxy for apache.
Now nginx listens to port 80 and apache listens to 8080. I made the changes in httpd.conf file accordingly.
Listen 8080
and
<VirtualHost 1.1.1.1:8080>
Now when someone tries to go to www.example.com, he is redirected to www.example.com/path but the script does not seem to execute. I am getting the following error on my web page:
Not Found
The requested URL /path was not found on this server.
Apache/2.4.25 (Unix) PHP/7.0.16 SVN/1.7.14 Server at www.example.com Port 80
The fact that it is redirecting tells me that the request from nginx to apache is working fine. There must be something wrong CGI execution. There is nothing in apache error logs and nginx error logs.
I do not understand this. Everything was working fine with apache but now when the request reaches apache, something breaks.