Hi Buschini,

The .cpp entry in the nginx.conf is to make nginx forward that request to
the fastcgi application running on 8000 port.
I think what you are talking about is for the static html files.

Thanks
Salil


On Mon, Jul 1, 2013 at 2:10 PM, Buschini Edouard <m...@ijaal.net> wrote:

> Hello,
>
> Correct me if I'm wrong but I think by default in nginx  docroot is
> /htdocs and look at the manual you'll see that by default nginx is started
> in a chroot in /var/www so you will have to put your index.cpp into
> /var/www/htdocs directory.
>
> Hope I could help you.
>  On Jul 1, 2013 7:56 AM, "Salil Wadnerkar" <rohsh...@gmail.com> wrote:
>
>> Hi,
>>
>> I am testing one C++ fastcgi program on nginx. I modified my nginx config
>> by adding this
>> block:
>>
>> -- /usr/local/share/nginx/nginx.conf ---
>>
>>    server {
>>         listen       80;
>>         server_name  localhost;
>>
>>        # pass the C++ scripts to FastCGI server listening on
>> 127.0.0.1:8000
>>         #
>>         location ~ \.cpp$ {
>>             fastcgi_pass   127.0.0.1:8000;
>>             fastcgi_param  SCRIPT_FILENAME
>>  $document_root$fastcgi_script_name;
>>             include        fastcgi_params;
>>         }
>>
>> I run my fastcgi application using spawn-fcgi:
>>
>> spawn-fcgi -p 8000 -n cppreadings
>>
>> And I access the cpp url like this:
>> curl http://localhost/index.cpp
>>
>> But, I get the error that the URL is not available and my nginx error log
>> shows:
>>
>> -- /var/www/logs/error.log ---
>>
>> 2013/07/01 21:21:07 [error] 28733#0: *1 open() "/htdocs/index.cpp" failed
>> (2: No such file or directory), client: 127.0.0.1, server: localhost,
>> request: "GET /index.cpp HTTP/1.1", host: "localhost"
>>
>> I am puzzled as to why it is taking the URL as /htdocs/index.cpp and
>> probably, that is the reason why it is failing. I can attach my
>> nginx.conf,
>> if anybody wants to view the complete config. But, basically the above is
>> the only change I made to the default nginx config.
>>
>> I am using the exact same config on Mac OS X and Arch Linux and it is
>> working there.
>> So, that'w why I am posting it in OpenBSD forum rather than nginx forum.
>>
>> Thanks
>> Salil

Reply via email to