Enabling friendly URL's

Discussion in 'General' started by Korsch, Mar 29, 2023.

  1. Korsch

    Korsch New Member

    Im running a xenforo forum from my server and want enable friendly URL's for API usage on Nginx, On my old control panel (cloudpanel) I could add the server configuration needed through the vhost in the control panel. On ISPConfig ive noticed a section in the website options labeled "Nginx Directives". could my server configuration code be added here or would I have to added to my config file at /etc/nginx/nginx.conf
    the code thats needed for the friendly urls is
    Code:
    location /forum/ {
        try_files $uri $uri/ /forum/index.php?$uri&$args;
        index index.php index.html;
    }
    
    location /forum/install/data/ {
        internal;
    }
    location /forum/install/templates/ {
        internal;
    }
    location /forum/internal_data/ {
        internal;
    }
    location /forum/library/ { #legacy
        internal;
    }
    location /forum/src/ {
        internal;
    }
    
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
    thanks in advance for all the help everyone!
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Yes, try adding them in there for any single / individual web site.


    No. Only add in there if you want them for all web sites on that nginx server.
     
    Korsch likes this.
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Only add the rewrite part:

    Code:
    location /forum/ {
        try_files $uri $uri/ /forum/index.php?$uri&$args;
        index index.php index.html;
    }
    
    location /forum/install/data/ {
        internal;
    }
    location /forum/install/templates/ {
        internal;
    }
    location /forum/internal_data/ {
        internal;
    }
    location /forum/library/ { #legacy
        internal;
    }
    location /forum/src/ {
        internal;
    }
    and not the PHP handler as that would cause the website to run under the wrong user plus opens up a security hole.
     
  4. Korsch

    Korsch New Member

    Are these things noted in the ISPConfig 3.1 Manual? If so it might be worth the purchase so I stop pestering with these questions and only come here for pressing issues.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    No, such rewrite rules are specific for each CMS and not ISPConfig specific.
     
    Korsch likes this.
  6. Korsch

    Korsch New Member

    adding this the Nginx Directives in site options did the trick! thank you for helping!
     
    ahrasis likes this.

Share This Page