Re: puzzling nginx behavior on OpenBSD
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; includefastcgi_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
Re: puzzling nginx behavior on OpenBSD
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; includefastcgi_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
Re: puzzling nginx behavior on OpenBSD
Hello, if think that you should try to set *root* directive. Best regards. On Mon, Jul 1, 2013 at 8:17 AM, Salil Wadnerkar rohsh...@gmail.com wrote: 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; includefastcgi_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
Re: puzzling nginx behavior on OpenBSD
Maybe you'll have more luck trying out the Nginx port (/etc/rc.d/enginx) rather than the default chrooted one? http://openbsd.7691.n7.nabble.com/Ruby-on-Rails-and-the-chrooted-nginx-8-td229745.html O.D. On 1. juli 2013 at 5:57 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; includefastcgi_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
Re: puzzling nginx behavior on OpenBSD
Hi, I specified the root explicitly (I think, by default it looks into /var/www/htdocs), but that did not help. I started the nginx in unsafe mode (non-chrooted mode) by specifying the -u flag. I also tried unix socket communication between nginx and fastcgi with the socket file in /var/www/ directory (though, the location is not important in a non-chrooted mode), but that did not help either. Anyway, thank you all of you for trying to help. I have deeper understanding of nginx and OpenBSD now. best regards Salil On Mon, Jul 1, 2013 at 11:08 PM, openda...@hushmail.com wrote: Maybe you'll have more luck trying out the Nginx port (/etc/rc.d/enginx) rather than the default chrooted one? http://openbsd.7691.n7.nabble.com/Ruby-on-Rails-and-the-chrooted-nginx-8-td229745.html O.D. On 1. juli 2013 at 5:57 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; includefastcgi_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
Re: puzzling nginx behavior on OpenBSD
I have my config file as such, location ~ \.php$ { root /htdocs; fastcgi_pass unix:/tmp/php.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /htdocs$fastcgi_script_name; include fastcgi_params; } On 07/01/2013 10:07 PM, Salil Wadnerkar wrote: Hi, I specified the root explicitly (I think, by default it looks into /var/www/htdocs), but that did not help. I started the nginx in unsafe mode (non-chrooted mode) by specifying the -u flag. I also tried unix socket communication between nginx and fastcgi with the socket file in /var/www/ directory (though, the location is not important in a non-chrooted mode), but that did not help either. Anyway, thank you all of you for trying to help. I have deeper understanding of nginx and OpenBSD now. best regards Salil On Mon, Jul 1, 2013 at 11:08 PM, openda...@hushmail.com wrote: Maybe you'll have more luck trying out the Nginx port (/etc/rc.d/enginx) rather than the default chrooted one? http://openbsd.7691.n7.nabble.com/Ruby-on-Rails-and-the-chrooted-nginx-8-td229745.html O.D. On 1. juli 2013 at 5:57 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; includefastcgi_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 -- Salim A. Shaw System Administrator OpenBSD CentOS / Free Software Advocate Need stability and security -- Try OpenBSD. BSD,ISC license all the way: Sell services, don't lease secrets