Welcome! Log In Create A New Profile

Advanced

How to configure nginx for fastCGI (not php)

Posted by mirko1974 
How to configure nginx for fastCGI (not php)
December 06, 2014 05:36PM
Hi all,

sorry if my request seems stupid but I am completely a newbie on nginx.
I tried to find the solution by myself and searching on this forum and on internet but I had no luck.

Basically I have an embedded webserver (developed with freepascal, it is an executable running on localhost:9000) that is developed to:
1) reply to commands on "/". Request to this usually are related to "static" files (templates that are modified on the fly and send)
2) reply to a series of REST uri (like "api/users", "api/clients" and so on).

Now, I changed the code a bit and transformed the webserver in a fastCGI because I want to take advantage of nginx speed and stability.

How should the configuration be?

I've tried several things, but nothing worked.
But again, I am a newbie.

Could you help me, please?

Mirko
Re: How to configure nginx for fastCGI (not php)
December 06, 2014 05:43PM
The same you would for php, php-cgi listens on a port, so does your application.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: How to configure nginx for fastCGI (not php)
December 06, 2014 05:55PM
itpp2012 Wrote:
-------------------------------------------------------
> The same you would for php, php-cgi listens on a port, so does your
> application.

Hi,

sorry... I haven't been clear.

The problem I am having with nginx + fastCGI (and that I am not having running the standalone webserver is that whatever I type on my browser after "localhost" I can always see only the text (without images or css or js) of the index page.

That also if I point to "localhost/api/users". that should reply with a json array of data.

My configuration is:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

server_name localhost;

location / {
include fastcgi_params;
fastcgi_pass localhost:9000;
}
}

Mirko
Re: How to configure nginx for fastCGI (not php)
December 06, 2014 06:03PM
mirko1974 Wrote:
-------------------------------------------------------
> itpp2012 Wrote:
> -------------------------------------------------------
> > The same you would for php, php-cgi listens on a port, so does your
> > application.
>
Hi again,

there is a difference between all the php configurations I saw and my situation.

php files have an extension (php) and all the configurations are tailored to identify that.

My application is a REST server. That means you send a GET command to "site.com/api/users/101" and you get the information about user 101. there is no filename extension I can use.

Mirko
Re: How to configure nginx for fastCGI (not php)
December 07, 2014 05:49AM
You might need proxy_pass, fastcgi requires a script to be passed.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: How to configure nginx for fastCGI (not php)
December 07, 2014 08:48AM
itpp2012 Wrote:
-------------------------------------------------------
> You might need proxy_pass, fastcgi requires a script to be passed.

Hi itpp2012,
I am a total newbie.

Could you elaborate a bit more, please? :)

Mirko
Re: How to configure nginx for fastCGI (not php)
December 07, 2014 09:25AM
Read the docs a bit;
http://nginx.org/en/docs/http/ngx_http_proxy_module.html

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready