HowTo : NginX - The Apache Replacement

How useful is this script/tutorial?


  • Total voters
    59

tsj5j

Verified User
Joined
Jun 22, 2007
Messages
24
@nightskiff: Your installation of PHP (at least CLI) appears to be corrupted or misconfigured.

I didn't have a need for SSL, so I didn't include that.
 

Boten

Verified User
Joined
Oct 6, 2008
Messages
36
I have this error

[[email protected] init.d]# /etc/init.d/nginx restart
[ÉCHOUÉ]
Warning: Invalid argument supplied for foreach() in /etc/rc.d/init.d/nginx.php on line 248
2008/12/04 11:58:34 [info] 15267#0: the configuration file /tmp/nginx.conf syntax is ok
11:58:34 4-12-08: [FATAL] Generated configuration has an error.
Please report this problem.
11:58:34 4-12-08: [FATAL] Error details is as following :
[[email protected] init.d]#
 

persor

New member
Joined
Dec 10, 2008
Messages
1
Could someone help me ?

I have a problem like this when I'm starting nginx
# /etc/init.d/nginx start

Warning: Invalid argument supplied for foreach() in /etc/init.d/nginx.php on line 230
spawn-fcgi.c.229: child exited with: 0
spawn-fcgi.c.229: child exited with: 0
spawn-fcgi.c.229: child exited with: 0
spawn-fcgi.c.229: child exited with: 0
spawn-fcgi.c.229: child exited with: 0

Html on server is working perfect, php is not working, on php-using-site I have a error :

502 Bad Gateway
nginx/0.7.26

Maybe someone knows what the hell is wrong ?
 

Stepashka

New member
Joined
Aug 26, 2008
Messages
23
I have this error

[[email protected] init.d]# /etc/init.d/nginx restart
[ÉCHOUÉ]
Warning: Invalid argument supplied for foreach() in /etc/rc.d/init.d/nginx.php on line 248
2008/12/04 11:58:34 [info] 15267#0: the configuration file /tmp/nginx.conf syntax is ok
11:58:34 4-12-08: [FATAL] Generated configuration has an error.
Please report this problem.
11:58:34 4-12-08: [FATAL] Error details is as following :
[[email protected] init.d]#

i have the same error
 

tsj5j

Verified User
Joined
Jun 22, 2007
Messages
24
I'm sorry if it's not working - I no longer administrate any DA servers.
 

IT_Architect

Verified User
Joined
Feb 27, 2006
Messages
1,107
be prepared to lose:
- .htaccess
- mod_rewrite
Which by extension means lose your business if it depends on search engine placement from friendly URLs. Then there is the issue of server-side stats.

With the hefty speed penalty of FastCGI as compared to Apache's CLI, I would think the mix of traffic would have to be heavily weighted toward static content for this combination to compete. lighttpd could not come even close to competing with Apache for dynamic content after 2.0 was relased, and its plight is considerably worse against 2.2.

I would think using NGINX or similar lightweight server to offload Apache for static content, would be a more logical fit. I think this is born out by where these types of servers are used in that role today, YouTube being one of them.

Thanks!
 

tsj5j

Verified User
Joined
Jun 22, 2007
Messages
24
Which by extension means lose your business if it depends on search engine placement from friendly URLs. Then there is the issue of server-side stats.

With the hefty speed penalty of FastCGI as compared to Apache's CLI, I would think the mix of traffic would have to be heavily weighted toward static content for this combination to compete. lighttpd could not come even close to competing with Apache for dynamic content after 2.0 was relased, and its plight is considerably worse against 2.2.

I would think using NGINX or similar lightweight server to offload Apache for static content, would be a more logical fit. I think this is born out by where these types of servers are used in that role today, YouTube being one of them.

Thanks!

Your post shows complete ignorance of nginx.

Firstly, it just disables apache-compatible url rewrites.
nginx does support url rewrites, but using different syntax.
So long as you're not doing large-scale shared hosting, or if your users are willing to adapt, the syntax is easy to pick up (but not directly convertible from Apache).

Secondly, FastCGI on nginx/lighttpd/Litespeed offers performance improvements over Apache's CLI.
Look at any benchmarks to find out.

Indeed. Static content does fit this purpose BETTER.
Based on anecdotal evidence, dynamic content usually enjoy 50 - 80% performance improvements (and load lightening).
For static content, alternate software like nginx can provide a boost of few hundred percent.
 

Kronus

Verified User
Joined
May 31, 2007
Messages
48
you can cut a few steps if you use Centos

add EPEL repo

then yum nginx and yum spawn-fci

check paths in the nginx.php file you make
 

shally87

Verified User
Joined
Mar 30, 2010
Messages
8
conf/mime.types in nginx.php should be just mime.types, because conf/mime.types full path is /usr/local/nginx/conf/conf/mime.types, the same problem with conf/fastcgi.conf, it should be replaced to fastcgi_params. And for debian systems you should use killall instead of killproc in /etc/init.d/nginx. These lines are not needed too:
Code:
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

Removing
Code:
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network
seems to give error.

By the way I have another error with the nginx.php
Warning: Invalid argument supplied for foreach() in /etc/rc.d/init.d/nginx.php on line 460
Warning: Invalid argument supplied for foreach() in /etc/rc.d/init.d/nginx.php on line 460

So how can I fix this?
 

Cyber-DL

Verified User
Joined
Jun 21, 2008
Messages
49
Hello

In Step 3.2 after writing cp command , i see this server :

[[email protected] src]# cp ./spawn-fcgi /usr/local/bin/spawn-fcgi
cp: cannot stat `./spawn-fcgi': No such file or directory

Note : I've compiled PHP 5.2.14 and compiled lighttpd without bz2
 

Cyber-DL

Verified User
Joined
Jun 21, 2008
Messages
49
I'ved Fixed My spawn-fcgi but after restarting nginx i see this errors :


[[email protected] init.d]# service nginx restart
[FAILED]
Warning: Invalid argument supplied for foreach() in /etc/rc.d/init.d/nginx.php on line 415

Warning: Invalid argument supplied for foreach() in /etc/rc.d/init.d/nginx.php on line 328
sh: -c: line 0: syntax error near unexpected token `newline'
sh: -c: line 0: `/usr/local/nginx/sbin/nginx -t -c /tmp/nginx.conf &> '

Warning: file_get_contents(/tmp/nginx.conf.out): failed to open stream: No such file or directory in /etc/rc.d/init.d/nginx.php on line 397
10:35:47 8-09-10: [FATAL] Generated configuration has an error. Please report this problem.
10:35:47 8-09-10: [FATAL] Error details is as following :
 

andreyka

Verified User
Joined
Aug 15, 2007
Messages
11
My 50 cents

1. You use spawn-fcgi. It is very old tool. Better use php-fpm.
2. You don't support .htacces. Use fallback nginx for proxy it to apache
3. Your script don't generate default host for nginx, which point top /var/www/html (phpmyadmin is unavalible)
4. Your script rewite ALL config. It is wrong. Use include and rewrite only changed config
5. You config is very big. You can use hash map for reduce it.

I don't reccomend use it to anybody, who can't understand nginx config.
 

syslint

Verified User
Joined
Oct 24, 2010
Messages
97
1. You use spawn-fcgi. It is very old tool. Better use php-fpm.
2. You don't support .htacces. Use fallback nginx for proxy it to apache
3. Your script don't generate default host for nginx, which point top /var/www/html (phpmyadmin is unavalible)
4. Your script rewite ALL config. It is wrong. Use include and rewrite only changed config
5. You config is very big. You can use hash map for reduce it.

I don't reccomend use it to anybody, who can't understand nginx config.

For all this solutions you may have a look into http://danginx.com/
 

tsj5j

Verified User
Joined
Jun 22, 2007
Messages
24
1. You use spawn-fcgi. It is very old tool. Better use php-fpm.
2. You don't support .htacces. Use fallback nginx for proxy it to apache
3. Your script don't generate default host for nginx, which point top /var/www/html (phpmyadmin is unavalible)
4. Your script rewite ALL config. It is wrong. Use include and rewrite only changed config
5. You config is very big. You can use hash map for reduce it.

I don't reccomend use it to anybody, who can't understand nginx config.

1. php-fpm was not mature at time of writing, i.e. 2007.
2. I don't use .htaccess at all, so I didn't implement it.
3/4/5. This was for personal use and released to help others. If you can do better, please post your solution.
 

tsj5j

Verified User
Joined
Jun 22, 2007
Messages
24
Personal opinions are better when combined with reasons.

Jeff

The dubious part.
1. He's advertising/spamming in a how-to guide about his paid services. If a product/person needs to stoop to such levels of advertisement, it doesn't speak much about the author. Strike 1.
2. He's violating nginx's license by redistributing nginx without attributing the copyright to the author. Once again, sounds like a dubious author with no care for copyright. Strike 2.

Now for the "works better" part.
If you're going to be spending a monthly price for your web server, a well-coded drop-in replacement for Apache would fare much better than a hastily fixed up script.
Litespeed offers (which nginx doesn't):
- .htaccess
- mod_rewrite and mod_security support
- native parsing of Apache's config files
- a nice web panel to administrate
- built-in anti-DDoS features
- and some other stuff that are nice to have, read up if you're interested
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,118
Location
California
Thanks for your clarification.

As far as his link to his own page, my understanding is that this should be allowed in direct response to questions. Perhaps I'm wrong. Perhaps he should only post a link in this thread to his advertising post (which is allowed). Or perhaps I'm completely wrong and he shouldn't be allowed to post anything related to his product in this thread. however I'm not going to be the judge of that.

As far as his violation of nginx's license, I haven't taken the time to search his site to see exctly what he's posting upon the actual redistribution, but in any event that should be taken up with the authors of nginx, not here.

Jeff
 
Top