• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question nginx - adding app.php to directoryIndex

Just use custom vhost template:

1. Create directory:

# mkdir -p /usr/local/psa/admin/conf/templates/custom/domain

2. Copy template:

# cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/

3. Edit custom template:

# vi /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php

Change line

Code:
location ~ /$ {
        <?php echo $VAR->domain->physicalHosting->proxySettings['directoryIndex'] ?>
    }

to:

Code:
location ~ / {
     index index.php index.html app.php;
     try_files $uri $uri/ /index.php?$args;
 }

4. Tell Plesk to rebuild the NGINX conf files for the domains on the server:

# /usr/local/psa/admin/bin/httpdmng --reconfigure-all

5. Enable PHP Settings for domain as "FPM application served by nginx"

6. Open http://domain.com/ where app.php is index page.
 
Hi, thanks for that!

I did the exact same thing a while back and I was getting "file not found" messages on nginix websites, had to move them to apache, then I reverted back to the original file and all works fine... :(
 
Hi octet,

I did the exact same thing a while back and I was getting "file not found" messages on nginix websites
Pls. be aware, that some content use ".htaccess" - files, which can't be read by NGINX. In such cases, you have to convert these ".htaccess" - files, when you use NGINX and add the ( additional ) NGINX directives at for example "Home > Subscriptions > YOUR-DOMAIN.COM > Apache & nginx Settings" ( textbox for: Additional nginx directives ).

Plesk offers as well a wonderfull tool called "htaccess to nginx" - converter. You find this ( free ) Plesk - extension at the "Extension catalog" ( "Home > Extensions > Extensions Catalog" ), or at => htaccess to nginx over ext.plesk.com


Pls. note as well, that it really helps to investigate issues/errors/problems, when you include depending log - file - entries AND the corresponding webserver - configuration files for the (sub)domain, located at: "/var/www/vhosts/system/(SUB-DOMAIN.)YOUR-DOMAIN.COM/conf/". We can't guess possible misconfigurations and therefore we can't answer questions without these essential informations. :(
 
Hi guys,

I've the same problem and I've installed the htaccess to nginx extension but now i have this error:

[emerg] unknown directive "setenv" in /var/www/vhosts/system/mydomanin.com/conf/vhost_nginx.conf

what can i do to solve it please?

Thanks a lot
 
Back
Top