1

Topic: Nginx not starting after upgrading from Ubuntu 16.06 LTS to 18.04 LTS

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.1 Mysql Edition
- Deployed with iRedMail Easy or the downloadable installer? Deployed
- Linux/BSD distribution name and version:  Ubuntu 18.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mysql
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Dear Forum members,

I'm struggling with getting Nginx work again after upgrading the Ubuntu to 18.04 LTS. Nginx is not starting due to:

Mar 24 19:24:41 mail.iemg.hu nginx[82118]: nginx: [emerg] no port in upstream "php_workers" in /etc/nginx/templates/fastcgi_php.tmpl:13
Mar 24 19:24:41 mail.iemg.hu nginx[82118]: nginx: configuration file /etc/nginx/nginx.conf test failed


Previously php fpm was used with unix socket, but I also tried to switch to tcp connection

PHP FPM 7.2 works:
root@mail:~# telnet localhost 9999
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

nginx conf seems good for me:
root@mail:~# cat /etc/nginx/conf-enabled/php-fpm.conf
upstream php_workers {
    server 127.0.0.1:9999;
}

root@mail:~# cat /etc/nginx/templates/fastcgi_php.tmpl
#
# Template used to handle PHP fastcgi applications
#
# You still need to define `SCRIPT_FILENAME` for your PHP application, and
# probably `fastcgi_index` if your application use different index file.
#
include fastcgi_params;

# Directory index file
fastcgi_index index.php;

# Handle PHP files with upstream handler
fastcgi_pass php_workers;
#fastcgi_pass server 127.0.0.1:9000;

# Fix the HTTPROXY issue.
# Reference: https://httpoxy.org/
fastcgi_param HTTP_PROXY '';



Please advise. I'm really not an expert with Nginx, only with apache (the two other host were upgraded without issues)

Thanks,
KovBal

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Nginx not starting after upgrading from Ubuntu 16.06 LTS to 18.04 LTS

Is Nginx configured to load config files under /etc/nginx/conf-enabled/ in /etc/nginx/nginx.conf?

3 (edited by banknote 2022-07-19 01:12:26)

Re: Nginx not starting after upgrading from Ubuntu 16.06 LTS to 18.04 LTS

For those who had the same problem. After updating nGinx, I encountered the same problem:
```
no port in upstream "php_workers" in /etc/nginx/templates/fastcgi_php.tmpl:13
```
I have used to use socket php-fpm connection. And when I returned to the following, everything returned to normal:

```
# fastcgi_php.tmpl

# Handle PHP files with upstream handler
fastcgi_pass unix:/run/php/php-fpm.sock;
# fastcgi_pass php_workers;  comment out it
```

and maybe also at:

```
# stub_status.tmpl

location = /status {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
    # fastcgi_pass php_workers;
    fastcgi_pass unix:/run/php/php-fpm.sock;
    deny all;
}
```