How to install Premium URL Shortener in ISPConfig with NGINX

Discussion in 'Programming/Scripts' started by Isai, May 11, 2023.

  1. Isai

    Isai New Member

    I'm having trouble installing premium-url-shortener in Ispconfig with NGINX.

    I don't understand if I'm doing something wrong or if ISPConfig is to blame.

    I'm an ISPConfig user since 4 years, but sometimes I get confused by some mysterious errors.

    This is the documentation for premium-url-shortener:
    https://gempixel.com/docs/premium-url-shortener

    This is the NGINX directives setting I added in ISPConfig.

    Code:
    server {
        listen 80;
        
        # MAKE SURE THE DOCUMENT ROOT IS THE /public IN THE FOLDER WHERE THE DOMAIN POINTS TO (required)
        root        /var/www/clients/client1/web78/web/public;
    
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-Content-Type-Options "nosniff";
    
        index index.php;
    
        charset utf-8;
    
        ## SAMPLE REWRITE RULE FOR THE SCRIPT (required)
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        ## 404 ERROR (optional)
        error_page 404 /index.php;
    
        ## THIS IS JUST A SAMPLE, IT WILL DEPEND ON YOUR SERVER
        location ~ \.php$ {
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            include fastcgi_params;
        }
    
        location ~ /\.(?!well-known).* {
            deny all;
        }
    }
    I see only a white screen. Can you tell me if I did something wrong?
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Of course. You cannot overwrite server {} via nginx directives.
     
  3. Isai

    Isai New Member

    Sorry, but I didn't understand.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    What @ahrasis meant is that you can nei nest server { ... } statements in Nginx. A website is already a server { .... } block, so you can not declare another server block inside a website via nginx directives field. Add only the directives that are specific to this application there. And you can not redeclare root in nginx either, search the forum for ##subroot## to learn how to define a sub root. e.g.: https://forum.howtoforge.com/threads/changing-root-directory.82357/#post-442649
     
    Isai likes this.
  5. Isai

    Isai New Member

    Thanks!
     

Share This Page