1

I'm hosting up rundeck, along with another site which happens to be php, in nginx on RHEL 7.5. I've got rundeck working, but can't get the other site working. I can get it TO the other site, but can't get php to work. I've followed the instructions at:

NGINX-multiSite

I'm sure it has something to do with my location blocks but can't quite get the hang of adding php support on a non / site. Anyone have a clue? Here's my nginx rundeck.conf file (working for nginx, 502 bad gateway error on other site) :

server {
listen 8080;
listen [::]:8080;
server_name myServer.myDomain;
access_log  /var/log/nginx/myLogFile.access.log;

location /wiki {
  alias /var/www/wiki/html;
  index index.html index.htm index.php;
}

location ~* \.php$ {
  include /etc/nginx/fastcgi_params;
  fastcgi_pass 127.0.0.1:8080;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location / {
  proxy_pass http://localhost:4440;
  proxy_set_header X-Forwarded-Host $host:$server_port;
  proxy_set_header X-Forwarded-Server $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}

And all I'm doing on the other site (wiki) is throwing out a php version info file. Any help would be appreciated! Thanks!

Eric
  • 43
  • 8
  • Tried moving over to port 9000, changing the rundeck.conf for my location block for php from 8080 as well as the /etc/php-fpm.d/www.conf file to point to 9000 (php-frm port). This helped a little bit. I now can open an html file at: http://myServer.myDomain:8080/wiki/index.html but not a php file there. It tells me "No input file specified." – Eric Nov 04 '19 at 20:07
  • You need to use a nested location for your PHP block so that it inherits the correct `alias`. See the `manage` block in [this answer](https://stackoverflow.com/questions/42443468/nginx-location-configuration-subfolders/42467562#42467562) – Richard Smith Nov 05 '19 at 09:25
  • Still getting "No input file specified". Changed the block to: location ^~ /wiki { alias /var/www/wiki/html; index index.php; if (!-e $request_filename) { rewrite ^ /wiki/index.php last; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include /etc/nginx/fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } – Eric Nov 05 '19 at 15:44
  • Boom! Had to add the root level php location block as well as the multi-level block, that link was the ticket, thanks Richard! – Eric Nov 05 '19 at 18:10

0 Answers0