Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-04-25, 08:23:00

Author Topic: nginx bad gateway  (Read 10798 times)

0 Members and 1 Guest are viewing this topic.

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
nginx bad gateway
« on: 2013-05-21, 11:13:35 »
Kloxo Version: kloxomr-6.5.0.f-2013031815

Issue: Fresh Install, switched to nginx on reboot, getting bad gateway on php files. Any solutions?
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #1 on: 2013-05-21, 11:20:26 »
Error log:

Code: [Select]
2013/05/21 08:10:37 [error] 1146#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /s HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:10:41 [error] 1146#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:10:42 [error] 1146#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:10:42 [error] 1146#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:10:43 [error] 1146#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:16:30 [error] 1146#0: *10 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:16:32 [error] 1146#0: *10 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
2013/05/21 08:16:32 [error] 1146#0: *10 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysite.com, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:57798", host: "mysite.com"
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: nginx bad gateway
« Reply #2 on: 2013-05-21, 11:21:41 »
Try to switch to apache and then back to apache.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #3 on: 2013-05-21, 11:23:54 »
Quote from: "MRatWork"
Try to switch to apache and then back to apache.

You mean, switch to apache and then back to nginx?
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #4 on: 2013-05-21, 11:28:16 »
When I switched to apache to test if php worked there but


Switched back to nginx, still getting 502 Bad Gateway.

Server yum installed php modules
Code: [Select]
[root@web ~]# yum list installed | grep php
kloxomr-thirdparty-phpmyadmin.noarch 4.0.0-1.mr                @kloxo-mr-release-neutral-noarch
lxphp.i686                           5.2.17-8.mr.el6           @kloxo-mr-release-version-arch
php.i686                             5.3.23-1.el6              @kloxo-mr-centalt
php-cli.i686                         5.3.23-1.el6              @kloxo-mr-centalt
php-common.i686                      5.3.23-1.el6              @kloxo-mr-centalt
php-devel.i686                       5.3.23-1.el6              @kloxo-mr-centalt
php-mbstring.i686                    5.3.23-1.el6              @kloxo-mr-centalt
php-mysql.i686                       5.3.23-1.el6              @kloxo-mr-centalt
php-pdo.i686                         5.3.23-1.el6              @kloxo-mr-centalt
php-pear.noarch                      1:1.9.4-4.el6             @base    
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: nginx bad gateway
« Reply #5 on: 2013-05-21, 12:00:03 »
Try 'sh /script/fix-chownchmod; sh /script/fixweb; sh /script/restart-services'.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #6 on: 2013-05-21, 12:11:55 »
Quote from: "MRatWork"
Try 'sh /script/fix-chownchmod; sh /script/fixweb; sh /script/restart-services'.

Did all of them, rebooted server, still stuck at bad gateway
PS: I am on CentOS 6.4 Final 32 Bit

Code: [Select]
[root@web nginx]# cd /script
[root@web script]# ./fix-chownchmod

- For help, type './fix-chownchmod --help'
- No argument supplied. Defaulting to all

Fixing Chown and Chmod
- chmod 755 FOR /usr/local/lxlabs/kloxo/cexe AND INSIDE
- chown apache:apache FOR /home/kloxo/httpd/ AND INSIDE
- chmod 644 FOR *.php* INSIDE /home/kloxo/httpd/
- chmod 755 FOR *.pl* INSIDE /home/kloxo/httpd/
.- chmod 755 FOR /home/kloxo/httpd/ AND INSIDE
- chmod 771 FOR /home/kloxo/httpd/
- chown root:root FOR /home/apache/ AND INSIDE
- chmod 755 FOR *.sh INSIDE /home/apache/
- chown root:root FOR /home/lighttpd/ AND INSIDE
- chmod 755 FOR *.sh INSIDE /home/lighttpd/
- chown root:root FOR /home/nginx/ AND INSIDE
- chmod 755 FOR *.sh INSIDE /home/nginx/
- chown admin:apache FOR /home/admin/
- chmod 751 FOR /home/admin/
chown: cannot access `/home/admin/kloxoscript/': No such file or directory
- chown admin:admin FOR INSIDE /home/admin/kloxoscript/
chown: cannot access `/home/admin/kloxoscript/': No such file or directory
- chown admin:apache FOR /home/admin/kloxoscript/
find: `/home/admin/kloxoscript/': No such file or directory
- chmod 644 FOR *.php* INSIDE /home/admin/kloxoscript/
find: `/home/admin/kloxoscript': No such file or directory
- chmod 755 FOR /home/admin/kloxoscript/ AND INSIDE
- chown mysite:apache FOR /home/mysite/
- chmod 751 FOR /home/mysite/
- chown mysite:mysite FOR INSIDE /home/mysite/kloxoscript/
- chown mysite:apache FOR /home/mysite/kloxoscript/
- chmod 644 FOR *.php* INSIDE /home/mysite/kloxoscript/
- chmod 755 FOR /home/mysite/kloxoscript/ AND INSIDE
- chown mysite:mysite FOR INSIDE /home/mysite/mysite.com/
- chmod 644 FOR *.php* INSIDE /home/mysite/mysite.com/
- chmod 755 FOR /home/mysite/mysite.com/ AND INSIDE
- chown mysite:mysite FOR /home/mysite/mysite.com/
- chmod 755 FOR /home/mysite/mysite.com/cgi-bin AND FILES
[root@web script]# ./fixweb

- For help, type './fixweb --help'
- No argument supplied. Defaulting to localhost (master) servers

Fixing Web server config
- 'defaults' and 'php-fpm' at 'localhost'
- 'mysite.com' ('mysite') at 'localhost'
[root@web script]# ./restart-services
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]
Stopping qmail-toaster: svscan qmail logging.
Starting qmail-toaster: svscan.
Stopping xinetd: supervise: fatal: unable to acquire pop3/supervise/lock: temporary failure
                                                           [  OK  ]
supervise: fatal: unable to acquire log/supervise/lock: temporary failure
supervise: fatal: unable to acquire log/supervise/lock: temporary failure
supervise: fatal: unable to acquire log/supervise/lock: temporary failure
Starting xinetd:                                           [  OK  ]
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@web script]#
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #7 on: 2013-05-21, 20:51:48 »
confirmed:
PHP-FM is not being installed after switching to nginx.

I solved it manually by

Installing php-fm
changing ports from 57xxx to 9000
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #8 on: 2013-05-21, 23:20:41 »
To be honest, this build of kloxo has no support for nginx.

1. Php-fm broken.

2. /home/nginx/conf/globals/php-fpm.conf:
    location / - already defined, disabling users create location / rules in website.conf
Errors: nginx: [emerg] duplicate location "/" in /home/nginx/conf/globals/php-fpm.conf:54

3. Multiple PHP-modules missing, such as
php-pecl-apc php-mysql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

After fixing all the problems, I am not able to access site with nginx.
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: nginx bad gateway
« Reply #9 on: 2013-05-21, 23:55:42 »
Switch from and to nginx running on my server but with 'extra' actions:

Steps:
1. Switch to nginx on 'switch applications'
2. run 'sh /script/fixweb'
3. run 'sh /script/restart-services'
4. If found error on step 3 (like 'Address already in use'), need reboot

About php branch switch. Php branch switch only switch for php and build-in module. External module like gd need reinstall separately. Kloxo-MR use 'yum replace' for switch php.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #10 on: 2013-05-22, 01:11:14 »
Quote from: "MRatWork"
Switch from and to nginx running on my server but with 'extra' actions:

Steps:
1. Switch to nginx on 'switch applications'
2. run 'sh /script/fixweb'
3. run 'sh /script/restart-services'
4. If found error on step 3 (like 'Address already in use'), need reboot

About php branch switch. Php branch switch only switch for php and build-in module. External module like gd need reinstall separately. Kloxo-MR use 'yum replace' for switch php.

I've re-installed 1815 build for the 4th time now, just after re-install I go switch applications from apache -> nginx, nginx -> apache and then again apache -> nginx, fixweb/phpfpm/php and reboot the whole server. I get 502 Gateway error.
I am pretty sure the php-fpm socks is not connected. When I manually install php-fpm and changed port to 9000 and then nginx worked.
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: nginx bad gateway
« Reply #11 on: 2013-05-22, 01:19:09 »
Have you try other php-types (like fcgid) for to make php-fpm or other is wrong?.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #12 on: 2013-05-22, 01:21:48 »
Quote from: "MRatWork"
Have you try other php-types (like fcgid) for to make php-fpm or other is wrong?.

How do you switch php types when in nginx?(php type option disabled for nginx) Would like to bring you one more issue, on apache(fresh install), php type: ruid2, getting blank php pages.
« Last Edit: 1970-01-01, 01:00:00 by Guest »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: nginx bad gateway
« Reply #13 on: 2013-05-22, 01:24:02 »
Quote from: "gorgon"
Quote from: "MRatWork"
Have you try other php-types (like fcgid) for to make php-fpm or other is wrong?.

How do you switch php types when in nginx? Would like you to bring one more, on apache(fresh install), php type: ruid2, getting blank php pages.
Sorry, I think you use nginx-proxy instead nginx.

Ok, we can discuss via YM or GTalk.
« Last Edit: 1970-01-01, 01:00:00 by Guest »
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline gorgon

  • Junior Member
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: nginx bad gateway
« Reply #14 on: 2013-05-22, 03:07:16 »
Issue Resolved.

Firstly downgrade nginx (1.4.1)

Quote
1. already set 1 domain
2. set to apache, php 5.3 and php-fpm_event
3. test domain for running well
4. if something wrong, run fixweb and restart-services
5. if setting for running well and then ready switch to nginx

Thank you MR :)
« Last Edit: 1970-01-01, 01:00:00 by Guest »

 


MRatWork Affiliates:    BIGRAF(R) Inc.    House of LMAR    EFARgrafix
Click Here

Page created in 0.029 seconds with 21 queries.

web stats analysis