Tomato-RAF
Tomato-RAF copied to clipboard
fastcgi listener not starting when nginx enabled and started.
When I enable nginx as follows:
Enable Server on Start: yes Keep Config Files: Yes Web Server Port default: 85 Web Server Name myserver Server Root Path /index.html / index.htm / index.php Server Priority Max. Perfor: -20, Min.Perfor: 19, default: 10 NGINX Custom configuration # NGINX Custom Parameters.
If I ssh into the router I see nginx runing on port 85 but php-cgi is NOT listening on any port.
Next I run: /usr/sbin/php-cgi -a -b 127.0.0.1:9000
And now my nginx server is able to serve up php files. Before this, i was getting 4040 not found erors for all php files since php listener was not running and nginx tries to route to a non existant 50x.html page (As configured in the nginx.conf)
For now the work around is to set this in the Admin init startup script for RAF: /usr/sbin/php-cgi -a -b 127.0.0.1:9000
Exactly, enter this in the custom window for nginx GUI and then PHP will run.
2014-07-19 22:02 GMT+02:00 Mark Vejvoda [email protected]:
When I enable nginx as follows:
Enable Server on Start: yes Keep Config Files: Yes Web Server Port default: 85 Web Server Name myserver Server Root Path /index.html / index.htm / index.php Server Priority Max. Perfor: -20, Min.Perfor: 19, default: 10 NGINX
Custom configuration # NGINX Custom Parameters.
If I ssh into the router I see nginx runing on port 85 but php-cgi is NOT listening on any port.
Next I run: /usr/sbin/php-cgi -a -b 127.0.0.1:9000
And now my nginx server is able to serve up php files. Before this, i was getting 4040 not found erors for all php files since php listener was not running and nginx tries to route to a non existant 50x.html page (As configured in the nginx.conf)
For now the work around is to set this in the Admin init startup script for RAF: /usr/sbin/php-cgi -a -b 127.0.0.1:9000
— Reply to this email directly or view it on GitHub https://github.com/Victek/Tomato-RAF/issues/12.
Add the following to custom nginx config window and rebooting makes it so the webserver does not even startup:
/usr/sbin/php-cgi -a -b 127.0.0.1:9000
cat /var/log/nginx/error.log shows:
1969/12/31 16:00:56 [emerg] 719#0: unexpected end of file, expecting ";" or "}" in /tmp/etc/nginx/nginx.conf:47 1969/12/31 16:01:12 [emerg] 743#0: unexpected end of file, expecting ";" or "}" in /tmp/etc/nginx/nginx.conf:47
I don't believe this is the fix, that is the nginx conf window which does not take command line. As mentioned if i add the command to admin startup init script then php works. Its as if stsartup of nginx (even with the correct defaults in nginx.conf) is not starting up the php service. I have to manually start it up.
ps shows:
nginx -c /tmp/etc/nginx/nginx.conf
cat /tmp/etc/nginx/nginx.conf shows:
NGinX generated config file
user root; worker_processes 1; worker_cpu_affinity 0101; master_process off; worker_priority 10; error_log /tmp/var/log/nginx/error.log; pid /tmp/var/run/nginx.pid; worker_rlimit_nofile 8192; events { worker_connections 512; } http { include /tmp/etc/nginx/mime.types; include /tmp/etc/nginx/fastcgi.conf; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; server { listen 85; server_name vsoft-home; access_log /tmp/var/log/nginx/access.log main; location / { root /tmp/mnt/sda1/www; index index.html index.htm index.php; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location /50x.html { root /tmp/mnt/sda1/www; } location ~ .php$ { root /tmp/mnt/sda1/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; } location ~ ^/(images|javascript|js|css|flash|media|static)/ { root /tmp/mnt/sda1/www; expires 10d; } } } }
Read it as example how to add in the configuration file .. https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/
Please look at my edited post above it already has those defaults for php and port 9000 but its not triggering the php service to run.
I'll update the configuration file to run PHP from the boot. I'm updating nginx to 1.7.3 version now.
What was missing from the config file? I'd like to know?
This patch ...
Pass all .php files onto a php-fpm/php-fcgi server.
location ~ .php$ {
Zero-day exploit defense.
http://forum.nginx.org/read.php?2,88845,page=3
Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass php; }
And where is fastcgi_params?
error log: 2015/06/07 11:00:59 [emerg] 7259#0: open() "/tmp/etc/nginx/fastcgi_params" failed (2: No such file or directory) in /tmp/etc/nginx/nginx.conf:42