Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx 1.27.5 > 1.29.0 upgrade fails nginx service

Discussion in 'Install & Upgrades or Pre-Install Questions' started by Pauly, Jun 26, 2025.

  1. Pauly

    Pauly Premium Member Premium Member

    17
    2
    3
    Jan 9, 2019
    UK
    Ratings:
    +4
    Local Time:
    8:35 AM
    Please fill in any relevant information that applies to you:
    • CentOS Version: Alma 9.5
    • Centmin Mod Version Installed:
      Code (Text):
      132.00 stable
    • Nginx Version Installed:
      Code (Text):
      1.27.5
    • PHP Version Installed:
      Code (Text):
      8.3.17
    • MariaDB MySQL Version Installed:
      Code (Text):
      10.6.22
    • When was last time updated Centmin Mod code base ? : today
    • Persistent Config:
      Code (Text):
      SET_DEFAULT_MYSQLCHARSET='utf8mb4'
      SELFSIGNEDSSL_ECDSA='y'
      PHPFINFO='y'
      PHP_OVERWRITECONF='n'
      PYTHON_INSTALL_ALTERNATIVES='y'
      LETSENCRYPT_DETECT='y'
      DUALCERTS='y'
      VHOSTCTRL_CLOUDFLAREINC='y'
      
    Nginx Upgrade Log

    Upgrade to 1.29.0 log (i think)
    nginx-upgrade-zlib_250625-165001.log - Pastebin.com

    Downgrade to 1.27.5/most recent log file
    nginx-upgrade-zlib_250625-165826.log - Pastebin.com

    The error log currently looks like multiple lines of this
    Code (Text):
    2025/06/25 16:50:48 [emerg] 3762136#3762136: "location" directive is not allowed here in /usr/local/nginx/conf/php.conf:1
    


    Doing monthly maintenance today and ran option 4 nginx upgrade to 1.29.0, this forced it to exit and wont restart
    I have rebooted the server and downgraded back to the previous version 1.27.5 but nginx still wont start citing the above error
    I have checked the php.conf file and not sure what the issue is ?
    I have pulled the php.conf file from this server and an identical working server and the contents is identical ?


    Code (Text):
    location ~ [^/]\.php(/|$) {
      include /usr/local/nginx/conf/503include-only.conf;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        #fastcgi_keep_conn on;
        fastcgi_pass dft_php;
        #fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        #fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
    
    # might shave 200+ ms off PHP requests
    # which don't pass on a content length header
    # slightly faster page response time at the
    # expense of throughput / scalability
    #sendfile on;
    #tcp_nopush off;
    #keepalive_requests 0;
    
    fastcgi_connect_timeout 360s;
    fastcgi_send_timeout 360s;
    fastcgi_read_timeout 360s;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 512 32k;
    fastcgi_busy_buffers_size 1m;
    fastcgi_temp_file_write_size 4m;
    fastcgi_max_temp_file_size 4m;
    fastcgi_intercept_errors off;
    
    # next 3 lines when uncommented / enabled
    # allow Nginx to handle uploads which then
    # passes back the completed upload to PHP
    #fastcgi_pass_request_body off;
    #client_body_in_file_only clean;
    #fastcgi_param  REQUEST_BODY_FILE  $request_body_file;
    
    #new .04+ map method
    fastcgi_param HTTPS $server_https;
    
    # comment out PATH_TRANSLATED line if /usr/local/lib/php.ini sets following:
    # cgi.fix_pathinfo=0
    # as of centminmod v1.2.3-eva2000.01 default is set to cgi.fix_pathinfo=1
    
    fastcgi_param  PATH_INFO          $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
    
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;
    
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      $document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;
    fastcgi_param  REQUEST_SCHEME     $scheme;
    fastcgi_param  HTTPS              $https if_not_empty;
    fastcgi_param  HTTP_PROXY         "";
    
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    
    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $server_name;
    
    # Set php-fpm geoip variables
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
    fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
    fastcgi_param GEOIP_REGION $geoip_region;
    fastcgi_param GEOIP_CITY $geoip_city;
    fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
    fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
    fastcgi_param GEOIP_LATITUDE $geoip_latitude;
    fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
    
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;
    
                       }
    
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,907
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    5:35 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    The nginx upgrade logs don't seem to be complete. See https://community.centminmod.com/threads/how-to-troubleshoot-nginx-installs-upgrades.17778/ and also sharing logs via dropbox https://community.centminmod.com/threads/using-dropbox-to-share-server-files.22327/#post-91368

    What is output from nginx config check command when you have the failed nginx server
    Code (Text):
    nginx -t
    

    Code (Text):
    nginx -t
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    

    also output from nginx -V command (wrap in quote bbcode)
    and output for wrap in CODE/CODEB bbcode
    Code (Text):
    systemctl status nginx --no-pager -l

    Code (Text):
    systemctl status nginx --no-pager -l
    ● nginx.service - Centmin Mod NGINX Server
         Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled)
        Drop-In: /etc/systemd/system/nginx.service.d
                 └─failure-restart.conf, openfileslimit.conf
         Active: active (running) since Thu 2025-06-26 00:20:00 PDT; 10min ago
       Main PID: 1289945 (nginx)
          Tasks: 17 (limit: 202744)
         Memory: 2.0G
            CPU: 4.196s
         CGroup: /system.slice/nginx.service
                 ├─1289945 "nginx: master process /usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf"
                 ├─1289946 "nginx: worker process"
                 ├─1289947 "nginx: worker process"
                 ├─1289948 "nginx: worker process"
                 ├─1289949 "nginx: worker process"
                 ├─1289950 "nginx: worker process"
                 ├─1289951 "nginx: worker process"
                 ├─1289952 "nginx: worker process"
                 ├─1289953 "nginx: worker process"
                 ├─1289954 "nginx: worker process"
                 ├─1289955 "nginx: worker process"
                 ├─1289956 "nginx: worker process"
                 ├─1289958 "nginx: worker process"
                 ├─1289959 "nginx: worker process"
                 ├─1289960 "nginx: worker process"
                 ├─1289961 "nginx: worker process"
                 └─1289962 "nginx: worker process"
    
     
  3. Pauly

    Pauly Premium Member Premium Member

    17
    2
    3
    Jan 9, 2019
    UK
    Ratings:
    +4
    Local Time:
    8:35 AM
    I have doubled checked the most recent log, have downloaded it and opened locally etc, it is complete everything is in the link above

    Have put the latest log file in dropbox
    Dropbox

    nginx -t
    Code (Text):
    nginx: [emerg] "location" directive is not allowed here in /usr/local/nginx/conf/php.conf:1
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    


    nginx -V
    Code (Text):
    nginx version: nginx/1.27.5 (250625-165913-almalinux9-ba2e74a)
    built by gcc 13.3.1 20240611 (Red Hat 13.3.1-2) (GCC)
    built with OpenSSL 3.2.2 4 Jun 2024
    TLS SNI support enabled
    configure arguments: --with-ld-opt='-Wl,-E -L/usr/local/zlib-cf/lib -L/usr/local/nginx-dep/lib -ljemalloc -Wl,-z,relro,-z,now -Wl,-rpath,/usr/local/zlib-cf/lib:/usr/local/nginx-dep/lib -pie -flto=2 -flto-compression-level=3 -fuse-ld=gold' --with-cc-opt='-I/usr/local/zlib-cf/include -I/usr/local/nginx-dep/include -m64 -march=native -fPIC -g -O3 -fstack-protector-strong -flto=2 -flto-compression-level=3 -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Wno-pointer-sign -Wimplicit-fallthrough=0 -Wno-implicit-function-declaration -Wno-cast-align -Wno-builtin-declaration-mismatch -Wno-deprecated-declarations -Wno-int-conversion -Wno-unused-result -Wno-vla-parameter -Wno-maybe-uninitialized -Wno-return-local-addr -Wno-array-parameter -Wno-alloc-size-larger-than -Wno-address -Wno-array-bounds -Wno-discarded-qualifiers -Wno-stringop-overread -Wno-stringop-truncation -Wno-missing-field-initializers -Wno-unused-variable -Wno-format -Wno-error=unused-result -Wno-missing-profile -Wno-stringop-overflow -Wno-free-nonheap-object -Wno-discarded-qualifiers -Wno-bad-function-cast -Wno-dangling-pointer -Wno-array-parameter -fcode-hoisting -Wno-cast-function-type -Wno-format-extra-args -Wp,-D_FORTIFY_SOURCE=2' --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --build=250625-165913-almalinux9-ba2e74a --with-compat --without-pcre2 --with-http_stub_status_module --with-http_secure_link_module --with-libatomic --with-http_gzip_static_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --with-stream --with-stream_ssl_module --with-http_realip_module --add-dynamic-module=../ngx-fancyindex-0.5.2 --add-module=../ngx_cache_purge-2.5.3 --add-dynamic-module=../ngx_devel_kit-0.3.2 --add-dynamic-module=../set-misc-nginx-module-0.33 --add-dynamic-module=../echo-nginx-module-0.63 --add-module=../redis2-nginx-module-0.15 --add-module=../ngx_http_redis-0.4.0-cmm --add-module=../memc-nginx-module-0.20 --add-module=../srcache-nginx-module-0.33 --add-dynamic-module=../headers-more-nginx-module-0.37 --with-pcre-jit --with-zlib=../zlib-cloudflare-1.3.3 --with-zlib-opt=-fPIC --with-http_ssl_module --with-http_v2_module
    


    systemctl status nginx --no-pager -l
    Code (Text):
    × nginx.service - Centmin Mod NGINX Server
         Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled)
        Drop-In: /etc/systemd/system/nginx.service.d
                 └─failure-restart.conf, openfileslimit.conf
         Active: failed (Result: exit-code) since Wed 2025-06-25 19:10:41 UTC; 12h ago
        Process: 43107 ExecStartPre=/usr/local/sbin/nginx -t (code=exited, status=1/FAILURE)
            CPU: 16ms
    
    Jun 25 19:10:41 server.xxx.co.uk systemd[1]: nginx.service: Scheduled restart job, restart counter is at 5.
    Jun 25 19:10:41 server.xxx.co.uk systemd[1]: Stopped Centmin Mod NGINX Server.
    Jun 25 19:10:41 server.xxx.co.uk systemd[1]: nginx.service: Start request repeated too quickly.
    Jun 25 19:10:41 server.xxx.co.uk systemd[1]: nginx.service: Failed with result 'exit-code'.
    Jun 25 19:10:41 server.xxx.co.uk systemd[1]: Failed to start Centmin Mod NGINX Server.
    Jun 25 23:13:01 server.xxx.co.uk systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
    You have new mail in /var/spool/mail/root
    

    Code (Text):
    systemctl status nginx --no-pager -l
    ● nginx.service - Centmin Mod NGINX Server
         Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled)
        Drop-In: /etc/systemd/system/nginx.service.d
                 └─failure-restart.conf, openfileslimit.conf
         Active: active (running) since Thu 2025-06-26 00:20:00 PDT; 10min ago
       Main PID: 1289945 (nginx)
          Tasks: 17 (limit: 202744)
         Memory: 2.0G
            CPU: 4.196s
         CGroup: /system.slice/nginx.service
                 ├─1289945 "nginx: master process /usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf"
                 ├─1289946 "nginx: worker process"
                 ├─1289947 "nginx: worker process"
                 ├─1289948 "nginx: worker process"
                 ├─1289949 "nginx: worker process"
                 ├─1289950 "nginx: worker process"
                 ├─1289951 "nginx: worker process"
                 ├─1289952 "nginx: worker process"
                 ├─1289953 "nginx: worker process"
                 ├─1289954 "nginx: worker process"
                 ├─1289955 "nginx: worker process"
                 ├─1289956 "nginx: worker process"
                 ├─1289958 "nginx: worker process"
                 ├─1289959 "nginx: worker process"
                 ├─1289960 "nginx: worker process"
                 ├─1289961 "nginx: worker process"
                 └─1289962 "nginx: worker process"
    
     
    Last edited: Jun 26, 2025
  4. eva2000

    eva2000 Administrator Staff Member

    58,907
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    5:35 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    for outputs you can mask the server main hostname if you want from public display by editing your post

    as to issue could be you edited your nginx vhost and have included php.conf in incorrect place? i.e. a stray missing semi-colon ; in nginx vhost somewhere or missing closing brace () in nginx vhost location context etc.

    do a recursive grep for php.conf include file references in nginx vhost config files that shows 5 lines of context before and after matches using command below - you can mask actual domain names for privacy from output
    Code (Text):
    grep -C5 -rin '/usr/local/nginx/conf/php.conf' /usr/local/nginx/conf/conf.d


    On fresh install, would have a demodomain.com.conf and virtual.conf nginx vhost with only references to php.conf include file, once you add other nginx vhosts should have other matches
    Code (Text):
    grep -C5 -rin '/usr/local/nginx/conf/php.conf' /usr/local/nginx/conf/conf.d
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-32-# Wordpress Permalinks example
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-33-#try_files \$uri \$uri/ /index.php?q=\$uri&\$args;
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-34-
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-35-            }
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-36-
    /usr/local/nginx/conf/conf.d/demodomain.com.conf:37:include /usr/local/nginx/conf/php.conf;
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-38-include /usr/local/nginx/conf/staticfiles.conf;
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-39-
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-40-include /usr/local/nginx/conf/drop.conf;
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-41-#include /usr/local/nginx/conf/errorpage.conf;
    /usr/local/nginx/conf/conf.d/demodomain.com.conf-42-include /usr/local/nginx/conf/vts_server.conf;
    --
    /usr/local/nginx/conf/conf.d/virtual.conf-37-# Wordpress Permalinks example
    /usr/local/nginx/conf/conf.d/virtual.conf-38-#try_files \$uri \$uri/ /index.php?q=\$uri&\$args;
    /usr/local/nginx/conf/conf.d/virtual.conf-39-          
    /usr/local/nginx/conf/conf.d/virtual.conf-40-            }
    /usr/local/nginx/conf/conf.d/virtual.conf-41-
    /usr/local/nginx/conf/conf.d/virtual.conf:42:include /usr/local/nginx/conf/php.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-43-include /usr/local/nginx/conf/staticfiles.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-44-include /usr/local/nginx/conf/include_opcache.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-45-
    /usr/local/nginx/conf/conf.d/virtual.conf-46-#include /usr/local/nginx/conf/phpstatus.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-47-include /usr/local/nginx/conf/drop.conf;
    


    checked an Almalinux 9 install's /usr/local/nginx/conf/php.conf copy and has

    Code (Text):
    location ~ [^/]\.php(/|$) {
      include /usr/local/nginx/conf/503include-only.conf;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        #fastcgi_keep_conn on;
        fastcgi_pass dft_php;
        #fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        #fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
    
    # might shave 200+ ms off PHP requests
    # which don't pass on a content length header
    # slightly faster page response time at the
    # expense of throughput / scalability
    #sendfile on;
    #tcp_nopush off;
    #keepalive_requests 0;
    
    fastcgi_connect_timeout 360s;
    fastcgi_send_timeout 360s;
    fastcgi_read_timeout 360s;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 512 32k;
    fastcgi_busy_buffers_size 1m;
    fastcgi_temp_file_write_size 4m;
    fastcgi_max_temp_file_size 4m;
    fastcgi_intercept_errors off;
    
    # next 3 lines when uncommented / enabled
    # allow Nginx to handle uploads which then
    # passes back the completed upload to PHP
    #fastcgi_pass_request_body off;
    #client_body_in_file_only clean;
    #fastcgi_param  REQUEST_BODY_FILE  $request_body_file;
    
    #new .04+ map method
    fastcgi_param HTTPS $server_https;
    
    # comment out PATH_TRANSLATED line if /usr/local/lib/php.ini sets following:
    # cgi.fix_pathinfo=0
    # as of centminmod v1.2.3-eva2000.01 default is set to cgi.fix_pathinfo=1
    
    fastcgi_param  PATH_INFO          $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
    
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;
    
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      $document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;
    fastcgi_param  REQUEST_SCHEME     $scheme;
    fastcgi_param  HTTPS              $https if_not_empty;
    fastcgi_param  HTTP_PROXY         "";
    
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    
    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $server_name;
    
    # Set php-fpm geoip variables
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
    fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
    fastcgi_param GEOIP_REGION $geoip_region;
    fastcgi_param GEOIP_CITY $geoip_city;
    fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
    fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
    fastcgi_param GEOIP_LATITUDE $geoip_latitude;
    fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
    
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;
    
                       }
     
  5. Pauly

    Pauly Premium Member Premium Member

    17
    2
    3
    Jan 9, 2019
    UK
    Ratings:
    +4
    Local Time:
    8:35 AM
    The grep output is below (sorry formatting was off, tried to tidy it up a bit)

    Code (Text):
    .conf' /usr/local/nginx/conf/conf.d
    /usr/local/nginx/conf/conf.d/virtual.conf-37-# Wordpress Permalinks example
    /usr/local/nginx/conf/conf.d/virtual.conf-38-#try_files \$uri \$uri/ /index.php?              q=\$uri&\$args;
    /usr/local/nginx/conf/conf.d/virtual.conf-39-
    /usr/local/nginx/conf/conf.d/virtual.conf-40-            }
    /usr/local/nginx/conf/conf.d/virtual.conf-41-
    /usr/local/nginx/conf/conf.d/virtual.conf:42:include /usr/local/nginx/conf/php.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-43-include /usr/local/nginx/conf/staticfiles.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-44-include /usr/local/nginx/conf/include_opcache.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-45-
    /usr/local/nginx/conf/conf.d/virtual.conf-46-#include /usr/local/nginx/conf/phpstatus.conf;
    /usr/local/nginx/conf/conf.d/virtual.conf-47-include /usr/local/nginx/conf/drop.conf;
    --
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-110-}
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-111-
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-112-
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-113-  }
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-114-
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf:115:  include /usr/local/nginx/conf/php.conf;
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-116-
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-117-  include /usr/local/nginx/conf/pre-staticfiles-local-t6forum.com.conf;
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-118-  include /usr/local/nginx/conf/pre-staticfiles-global.conf;
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-119-  include /usr/local/nginx/conf/staticfiles.conf;
    /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf-120-  include /usr/local/nginx/conf/drop.conf;
    --
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-112-
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-113-  }
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-114-
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-115-
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-116-
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf:117:  include /usr/local/nginx/conf/php.conf;
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-118-
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-119-  include /usr/local/nginx/conf/pre-staticfiles-local-t7forum.com.conf;
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-120-  include /usr/local/nginx/conf/pre-staticfiles-global.conf;
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-121-  include /usr/local/nginx/conf/staticfiles.conf;
    /usr/local/nginx/conf/conf.d/t7forum.com.ssl.conf-122-  include /usr/local/nginx/conf/drop.conf;
    --
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-82-  # Wordpress Permalinks example
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-83-  #try_files $uri $uri/ /index.php?q=$uri&$args;
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-84-
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-85-  }
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-86-
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf:87:  include /usr/local/nginx/conf/php.conf;
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-88-
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-89-  include /usr/local/nginx/conf/pre-staticfiles-local-craftertgeforum.com.conf;
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-90-  include /usr/local/nginx/conf/pre-staticfiles-global.conf;
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-91-  include /usr/local/nginx/conf/staticfiles.conf;
    /usr/local/nginx/conf/conf.d/craftertgeforum.com.ssl.conf-92-  include /usr/local/nginx/conf/drop.conf;
    


    I have double checked the php.conf file (theres a copy of it in my opening post) and it is 100% identical to the one you posted ?
     
    Last edited: Jun 26, 2025
  6. Pauly

    Pauly Premium Member Premium Member

    17
    2
    3
    Jan 9, 2019
    UK
    Ratings:
    +4
    Local Time:
    8:35 AM
    Would the domain.com.conf have any relevance here in particular the location element for XF friendly URLs ?
     
  7. eva2000

    eva2000 Administrator Staff Member

    58,907
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    5:35 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    FYI, seems you ended up with 2 competing PHP server location matches causing syntax issues - your added version and Centmin Mod's usual default via php.conf include file.

    your added location match for PHP isn't needed in Centmin Mod
    Code (Text):
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    [URL='http://127.0.0.1:9000/']127.0.0.1:9000[/URL];
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }


    which would of broken Nginx in Centmin Mod as PHP is handled by php.conf include file created and setup with each Nginx vhost created by Centmin Mod

    Code (Text):
    include /usr/local/nginx/conf/php.conf;
     
  8. Pauly

    Pauly Premium Member Premium Member

    17
    2
    3
    Jan 9, 2019
    UK
    Ratings:
    +4
    Local Time:
    8:35 AM
    @eva2000 helped me tweak the conf file yesterday but im still having an issue with nginx failing to start

    nginx -t
    Code (Text):
    nginx: [emerg] duplicate listen options for 0.0.0.0:443 in /usr/local/nginx/conf/conf.d/t6forum.com.ssl.conf:15
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    


    t6forum.com.ssl.conf file is

    Code (Text):
    
    #x# HTTPS-DEFAULT
     server {
       listen   80;
    #x#  
       server_name t6forum.com www.t6forum.com;
       return 302 https://t6forum.com$request_uri;
       root /home/nginx/domains/t6forum.com/public;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    #      
    
    server {
      listen 443 ssl reuseport;
      http2 on;
     
      server_name t6forum.com www.t6forum.com;
    
      include /usr/local/nginx/conf/ssl/t6forum.com/t6forum.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      # cloudflare authenticated origin pull cert community.centminmod.com/threads/13847/
      #ssl_client_certificate /usr/local/nginx/conf/ssl/cloudflare/t6forum.com/origin.crt;
      #ssl_verify_client on;
     
     
     
      # mozilla recommended
      ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      add_header X-Xss-Protection "1; mode=block" always;
      add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      #add_header Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()";
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/t6forum.com/log/access.log combined buffer=256k flush=5m;
      #access_log /home/nginx/domains/t6forum.com/log/access.json main_json buffer=256k flush=5m;
      error_log /home/nginx/domains/t6forum.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/t6forum.com/autoprotect-t6forum.com.conf;
      root /home/nginx/domains/t6forum.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
        try_files $uri $uri/ /index.php?$uri&$args;
        index index.php index.html;
      }
    
    
    location ^~ /install/data/ {
        internal;
    }
    location ^~ /install/templates/ {
        internal;
    }
    location ^~ /internal_data/ {
        internal;
    }
    location ^~ /library/ { #legacy
        internal;
    }
    location ^~ /src/ {
        internal;
    }
    
      include /usr/local/nginx/conf/php.conf;
     
      include /usr/local/nginx/conf/pre-staticfiles-local-t6forum.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      #include /usr/local/nginx/conf/staticfiles.conf;
      #include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
     
  9. Pauly

    Pauly Premium Member Premium Member

    17
    2
    3
    Jan 9, 2019
    UK
    Ratings:
    +4
    Local Time:
    8:35 AM
    I have 3 domains on this server and i have managed to get nginx running again and my main site backup and running by hiding the .conf files of the other 2 domains and this removes the duplicate listen

    Now i thought i had to have consistant options across all listen statements so i currently have all three domain.conf files the same apart from the domain names ?

    Should this part be identical on all three .confs ?

    server {
    listen 443 ssl reuseport;
    http2 on;
     
  10. eva2000

    eva2000 Administrator Staff Member

    58,907
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    5:35 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    reuseport is only meant to be used once per port and IP address pairing, so only used once to apply to all vhosts. So remove other instances of reuseport for other nginx vhosts. Centmin Mod menu option 2 or nv nginx vhost creation routines usually handle all that by checking if reuseport in listen directive already exists so subsequent nginx vhosts created will skip adding reuseport if already detected. The issue you have is you manually added reuseport to other nginx vhost listen directives :)