vhost makes CMS navigate only Home Page

Discussion in 'Installation/Configuration' started by Schweben, Apr 21, 2021.

  1. Schweben

    Schweben New Member

    Hi,

    Ubuntu 20.04.2 (Focal Fossa)
    ISPConfig 3.2.4
    CMS is Joomla 3.9.26
    PHP 7.4 FPM/FastCGI

    First of all i would like to say that on the previous hosting my website was working fine,
    but as i already wrote on title, ISPConfig vhost file makes my Joomla website navigate only on Home Page,
    in fact clicking on some links i get an awful 404 Not Found.
    I saw that website vhost has these PHP conf:

    Code:
            location ~ \.php$ {
                try_files /2b4368792f2ff8e968d27cb81d223a9b.htm @php;
            }
    
            location @php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
              
                fastcgi_pass unix:/var/lib/php7.4-fpm/web3.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
            }
    
    I resolved adding this snipped onto SItes -> Options -> nginx Directives
    Code:
            location / {
                  try_files $uri $uri/ /index.php?$args;
            }
    
    My question is: can I solve my problem in a more effective and elegant way?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    If your CMS requires a custom URL rewriting configuration, e.g. for search engine-friendly URL's, then you must add this config in the Nginx directives field, as you did now. This is not ISPConfig specific btw, it depends on the web server that you have chosen. Your old hoster probably used Apache and not Nginx and for Apache, that's not required as most CMS ship with .htaccess files which contain these rules for apache only. if you have many Joomla sites, then you can add this as a predefined snippet under System > Directive snippets. or you install your ISPConfig server with Aapche instead.
     
    Th0m likes this.
  3. Schweben

    Schweben New Member

    I tried to insert my "try_files" snippet as predefined snippet under System > Directive snippets:

    Code:
           location / {
                 try_files $uri $uri/ /index.php?$args;
           }
    But nothing is changed, i can see only the Home Page of my Joomla website. The website vhost file is not changed, the modification seems to takes no effect. I was thinking it was a simple modification.
    I did what you you said but .... ..do i have to do something before ?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You have to apply it to the website by selecting the snippet in the website settings of the site where you want to apply it to. Or, as I wrote above, add it to the nginx directives field of the website, which is on the options field of the website.

    But maybe you should consider to reinstall your system by using an ISPConfig Apache setup if you are not familiar with nginx. Nginx is faster than apache, but it#s not as easy to use and requires more admin knowledge as you have to write and add custom directives in most cases for each site individually.
     
  5. Schweben

    Schweben New Member

    now i understand, i have to recall the "try_files" snippet from site configuration options tab.
    Now it works fine! And it was peace forever ...

    Thank you.
     
    Last edited: Apr 22, 2021

Share This Page