Hello, My system is FreeBSD-Stable (9.2) amd64, nginx 1.5.2.. I am migrating from lighttpd and have 2 questions:
1. I have read several places (http://wiki.nginx.org/FcgiExample) that fastcgi must be started separately. However, my system has two startup scripts available in /usr/local/etc/rc.d: php-fpm and spawn-fcgi. Lighttpd was able to use spawn-fcgi but nginx is not able? What is the difference between these 2 and which one should I use (and how startup of nginx will spawn)? Unfortunately both services failto start when called (service foo onestart), but I would ike to know which one to try and debug instead of rolling the dice.
2. I have several sub-pages I want to serve and use "location" to specify the sub-folders (from what I have read in the manual/example docs). I can't seem to get the cgi location correct, so here's my partial config:
http {
include mime.types;
include fastcgi_params;
default_type application/octet-stream;
index index.html index.htm index.php;
server {
listen 127.0.0.1:80;
server_name mysys;
root /data/http;
# 1 location works
location /pub/ {
autoindex on;
}
# 2 location fails
location /sitebar/ {
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param PATH_INFO $fastcgi_script_name;
} }
If I have 5-6 more sub-folders under root, what would be the best syntax for this - something like above or the opposite like:
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param PATH_INFO $fastcgi_script_name;
location /folder1/ {
}
location /folder2/ {
}
}
Thanks & Regards.
1. I have read several places (http://wiki.nginx.org/FcgiExample) that fastcgi must be started separately. However, my system has two startup scripts available in /usr/local/etc/rc.d: php-fpm and spawn-fcgi. Lighttpd was able to use spawn-fcgi but nginx is not able? What is the difference between these 2 and which one should I use (and how startup of nginx will spawn)? Unfortunately both services failto start when called (service foo onestart), but I would ike to know which one to try and debug instead of rolling the dice.
2. I have several sub-pages I want to serve and use "location" to specify the sub-folders (from what I have read in the manual/example docs). I can't seem to get the cgi location correct, so here's my partial config:
http {
include mime.types;
include fastcgi_params;
default_type application/octet-stream;
index index.html index.htm index.php;
server {
listen 127.0.0.1:80;
server_name mysys;
root /data/http;
# 1 location works
location /pub/ {
autoindex on;
}
# 2 location fails
location /sitebar/ {
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param PATH_INFO $fastcgi_script_name;
} }
If I have 5-6 more sub-folders under root, what would be the best syntax for this - something like above or the opposite like:
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param PATH_INFO $fastcgi_script_name;
location /folder1/ {
}
location /folder2/ {
}
}
Thanks & Regards.